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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Rename File

(1) ShareShare
ReportReport
Posted on by 2
I have created a simple flow that saves an email attachment that was received in Outlook to a SharePoint site.
 
When I receive the email attachment, the file is called "DW_DBRSACCT.csv". Before it saves in the SharePoint site, I need the output file name to be "DW_DBRSACCT_YYYY_MM_DD.csv".
 
How can I accomplish this?
Categories:
I have the same question (0)
  • Suggested answer
    Vish WR Profile Picture
    3,748 on at
     
    1. Open your Create file (SharePoint) action.

    2. Click into the File Name field.

    3. Switch to the Expression tab in the dynamic content popup.

    4. Paste the following expression:

    5.  concat('DW_DBRSACCT_', formatDateTime(utcNow(), 'yyyy_MM_dd'), '.csv')

  • Suggested answer
    sumit_artesian Profile Picture
    261 on at
     
    To rename the file in the format that you specified, here is how you can setup your flow. I have used a "Manually trigger a flow" trigger, but you can keep your original "When an email arrives" trigger. Sharing a few screenshots for your reference.
     
    Note: Change triggerBody()?['file']?['name'] with the attachment name that is exposed from your "When an email arrives" trigger.
     
    Overall flow:
     
    Initialize variable:
    Value: 
    slice(triggerBody()?['file']?['name'], 0, lastIndexOf(triggerBody()?['file']?['name'], '.'))

    Initialize variable 1:
    Value: 
    slice(triggerBody()?['file']?['name'], lastIndexOf(triggerBody()?['file']?['name'], '.'))

    Create file:
    File Name: 
    concat(variables('varFileName'), '_', formatDateTime(utcNow(), 'yyyy_MM_dd'), variables('varExtension'))

    File used in this demo:
    Result:
     
    Please let me know if you face any other issues.
     
    Please âœ… Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item.
    If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like! 🩷

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard