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

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

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

Anonymous
Not applicable

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

Anonymous
Not applicable

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"

Anonymous
Not applicable

Dear v-yuazh-msft,

Your way works good! Thank you very much!

RobertVT
Regular Visitor

I was reading this older post about renaming files. I have a report that I get from a provider. The name of the file PDF is ALWAYS the same so when I run a FLOW to add the attached report to the Sharepoint document library from my group email box,  it just updates the old one. I think this may work if I can rename the attachment to the date the email came in and the the default name it is giving like this:

 

Report Name now: Software Report

Change it to: Software Report(Todays inbox Date).pdf

 

I think this type of flow might work but can I get some assistance on how I would do this with modifications to this flow?

 

Thanks

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,111)