In a document library folder, when a user creates a new document, instead of it being named 'Document' when created, I want it to be named as the last name of the user. I have explored trying to do this through a Flow but there does not seem to be a way to rename a document. The user cannot rename the document themselves as they do not have delete permission.
The"Test Library" is your library name.
The SP.Data part in the body needs to be checked via the following link
The last outputs part is your required file name format.