cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

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
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

7 REPLIES 7
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

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"

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (8,390)