cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Renaming files using a Flow

Hello Apologies for the double post but I am looking for assistance. I came across this post https://powerusers.microsoft.com/t5/Building-Flows/Modify-Dynamic-Content-Before-Use-in-Flow/m-p/118..., and I think it may help with a problem I'm having. I get tens of spreadsheets sent to me every month, all with filenames that are composed of random numbers. This flow successfully moved them to my Sharepoint library and renamed it with the datestamp. How can I adapt this flow to name a file specifically so I can use formula in Excel to refer to it? I would also like the flow to remove the existing filename completely before renaming it (in my example the original file was called Book1) For example: This Flow renamed my file: 201805240242Book1 Can I make the flow call the file: PhoneDataParks Any help would be appreciated Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuazh-msft
Community Support
Community Support

Hi @ danielfeatley,

 

 

Please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Compose as below:

concat('PhoneDataParks','.',first(skip(split(items('Apply_to_each')?['Name'],'.'),1)))

Also you could change the Compose Action input with the formula below:

"@concat('PhoneDataParks','.',first(skip(split(items('Apply_to_each')?['Name'],'.'),1)))"

 

 

When a new email arrives with an attachment, the flow would run successfully as below:

Capture.PNG

 

The file would be created in the folder as below:

Capture.PNG

 

 

Please let me know if your problem could be solved.

 

 

Regards,
Alice Zhang

View solution in original post

8 REPLIES 8
v-yuazh-msft
Community Support
Community Support

Hi @ danielfeatley,

 

 

Please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Compose as below:

concat('PhoneDataParks','.',first(skip(split(items('Apply_to_each')?['Name'],'.'),1)))

Also you could change the Compose Action input with the formula below:

"@concat('PhoneDataParks','.',first(skip(split(items('Apply_to_each')?['Name'],'.'),1)))"

 

 

When a new email arrives with an attachment, the flow would run successfully as below:

Capture.PNG

 

The file would be created in the folder as below:

Capture.PNG

 

 

Please let me know if your problem could be solved.

 

 

Regards,
Alice Zhang

View solution in original post

Anonymous
Not applicable

Alice

 

I've built the Flow this morning and it seems to do exactly what I asked!

 

Thank you so much!

 

Daniel

Thank you so much for this. You've saved me a lot of time.

Hi @v-yuazh-msft 

 

I have a question.
Can I change the name of the file using the body text from the email.
I can change the name of the files without problems but as soon as I want to open the document on sharepoint an error occurs

Are you naming the document as a file type? For a Word file, you would want to name it "Output.docx" or for a Powerpoint, "Output.pptx"

I am trying to get the attachement from an email to save in a file, and be renamed beginning with today's date (09-12-19) and the subject line (or just a portion of it if possible). I have the attachement saving to a file loaction but i am stuggling with the rename process. Can anyone help?

this solution did not work for me as it keeps giving an error on the "Create File" (SharePoint) action of the flow. This is the error:

InvalidTemplate. Unable to process template language expressions in action 'Create_file' inputs at line '1' and column '2790': 'The template language function 'base64ToBinary' expects its parameter to be a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64ToBinary for usage details.'.

I have verified that "Include Attachments" is set to "yes"

Dear v-yuazh-msft,

Your way works good! Thank you very much!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,608)