cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alopez222
Helper IV
Helper IV

How can I rename an excel file using the flow below?

I have this flow that is triggered by a created item in a list. Basically I am creating a new folder and copying and pasting an excel file into the newly created folder. This works just fine but now I would like to rename the excel file with the name of the folder. The name of the folder will change depending on the Project field in a list within the site. How can I do this?

 

alopez222_1-1644360256574.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @alopez222 ,

check the action input and output in the flow run history, it should tell you what value you're trying to update and if the update was successful. And you should add also the file extension to the new name.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

3 REPLIES 3
tom_riha
Super User
Super User

Hello @alopez222 ,

you can rename the file with an HTTP request.

Method: POST

Uri: _api/web/lists/GetByTitle('<LibraryName>')/items(<DocumentID>)/validateUpdateListItem

Body:
{
    "formValues":[
	{
	    "FieldName": "FileLeafRef",
	    "FieldValue": "<NewFileNameWithExtension>"
	}
    ]
}

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

While reading the link to the article it says to make the FieldValue equal to a function. This does pop up when I try looking for it. Instead I replaced it with the Project field as seen in picture 2. Unfortunately, this didn't result in what I hoped for. The name of the excel file within the folder isnt the same name as the folder, in this case 0123456.

alopez222_0-1644507450774.png

alopez222_1-1644507626765.png

Results:

alopez222_4-1644507677997.png

 

alopez222_3-1644507664486.png

 

 

Hello @alopez222 ,

check the action input and output in the flow run history, it should tell you what value you're trying to update and if the update was successful. And you should add also the file extension to the new name.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,412)