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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Save Attachement from email and rename file without date

(0) ShareShare
ReportReport
Posted on by 7

Hi, I am new with Power automate.

 

I am trying to save attachement from email into a my own folder. This parts works well if I only use the name of the file. My issue is to save this file with the another name.

 

The files comes with a project name follow by the date of the day. Example: 56Afnvproject_20220815.xslx. I would like to delete the date at the end of the file so other system can find the file.

 

My daily email only contains one file. 

 

Thanks,

 

Pierre

I have the same question (0)
  • Verified answer
    MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at
    Re: Save Attachement from email and rename file without date

    Hello @Pierre_EOLEN ,

    in the number of last characters to be removed is always the same, you can follow this steps:

    1. Add the "Get attachment (V2)" action:

    The Message Id and Attachments Attachment Id are grabbed from the Trigger

    MarconettiMarco_0-1660888940808.png

    2. Add a "Compose" action in which put the following expression:

    substring(items('Apply_to_each')?['name'],0,sub(length(items('Apply_to_each')?['name']),14))

    This function will remove the last 14 characters, including the extension ".xlsx"

    MarconettiMarco_1-1660889064921.png

    3. Add the OneDrive "Create file" action, where put the previous Compose outputs in the "File Name" +.xlsx

    MarconettiMarco_2-1660889151883.png

    Add the "Content Bytes" value, grabbed from the "Get Attachment" action, in the "File Content" field.

     

    If I have answered your question, please mark my post as Solved.
    If you like my response, please give it a Thumbs Up.

    BR,

    Marco

     

     

  • Pierre_EOLEN Profile Picture
    7 on at
    Re: Save Attachement from email and rename file without date

    Thanks a lot Marco,

     

    If people are beginner like me, the compose and create must be inside the loop. I had to do some test before succeed it.

     

    Pierre

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 659 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 386 Moderator

#3
chiaraalina Profile Picture

chiaraalina 290

Last 30 days Overall leaderboard