web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Remove part of a file ...
Power Automate
Suggested Answer

Remove part of a file name before saving to Sharedrive

(1) ShareShare
ReportReport
Posted on by 6
Hi,
 
I currently have a flow that saves a daily .csv report sent to my email from Salesforce every morning to a Sharedrive folder.
 
The file name is saved as such:
 
 
As part of my flow I would like to rename the file so it cuts off the time portion of the file name and is saved like this instead:
 
Thank you for the help!
Categories:
I have the same question (0)
  • Suggested answer
    trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    Here's one way that will work for you; albeit there are lots of other ways too.  This way is kinda straightforward and easy to understand and duplicate.
     
     
    In this example, I have the file name as a variable so I can refer to it as dynamic content like you will in your flow.
     
     
    Next I use a Compose and use the expression split() and I split at the '.' so I isolate the file name from the '.csv'.
     
    split(variables('FileName'),'.')
     
     
    concat(substring(outputs('Compose_2')[0],0,37),'.csv')
     
     
     
    Next I have a second Compose the uses a simple substring() and concat().  First I use substring() and get the output of the Compose_2[0] - that's the file name without the '.csv'.
     
    I start in position 0 and I want the first 37 characters.  That's going to trim off the time part of the file name.
     
    Lastly, I wrap that in concat() and I add the .csv back into the file name so I end up with output from this action that can be referred to in your create file action as the file name.
     
     
    ------------------------------------------------


    If this was helpful, please like and/or mark as a verified answer to help others find this too!


    Always glad to help! 💯💯💯💯💯

    Tom 

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     

     
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    The formatting was a little wierd in the last post, but here's the entire flow.
     
    So 1st compose uses split(), 2nd uses concat() and substring().
     
  • CU07081902-0 Profile Picture
    6 on at
    Thank you for your response Trice602! Would this be a flow of its own or would I add this to my existing flow that saves the email attachment to my sharedrive folder. Here is a picture of that flow. If so where in my existing flow would I add the rename steps?

  • AlexEncodian Profile Picture
    4,409 Moderator on at
    If the file is always the same i.e. "Historical Pipeline Export" etc, then you dont need to rename. Why don't you just give it the name you want in the Create File action. For the date portion, you can use the formatdatetime() function.
     
    If the file is always different and you want the name to be dynamic i.e. the same as the file you receive but just change the date portion, you again dont need to rename the file. Just implement the logic others have suggested below and add it to your create file step in the filename field.
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hey there!
     
    I am following up on this post remove part of a file name before saving to sharedrive in this category building flows from 08/07/2024.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 4 replies and 1 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard