Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - General Discussion
Unanswered

How to Set Up a Flow in Power Automate to Send Emails with Attached Files According to the Month

Like (1) ShareShare
ReportReport
Posted on 13 Aug 2024 14:09:45 by 12
Hey guys,

I'm trying to set up a scheduled flow in Power Automate that sends emails with attached files. Here's what I'd like to do:

Objective:

Create a scheduled flow that sends an email with a file attachment.
File Source:

The stored files are on my OneDrive.
Shipping Logic:

I would like the stream to trigger automatically whenever a new file is placed in the specific OneDrive folder.
I have three different files, each intended for a specific person. To avoid conflicts, I renamed the files in the format: person1_July, person2_July, and person3_July.
Each month the file will only change the unnamed month, so the flow should select files based on the current month.



Categories:
  • Santiago Profile Picture
    12 on 13 Aug 2024 at 16:28:20
    How to Set Up a Flow in Power Automate to Send Emails with Attached Files According to the Month
    Hello, what I said was very confusing, I'm sorry. 

    So what I need is the following, a scheduled flow that is triggered every X day of the month. 

    My file will come from a OneDrive folder, but each month it will be a different file.
    So that my flow knows which file to send by email, I would like to name it with the name of the month in which it should be sent (this is an example).

    What happens is that I have to send it to 3 different people and each one will have 1 specific file. 
    I thought about doing all of this in 1 flow, but if that's not possible, I can do 1 flow for each.
  • Michael E. Gernaey Profile Picture
    42,048 Super User 2025 Season 1 on 13 Aug 2024 at 15:27:41
    How to Set Up a Flow in Power Automate to Send Emails with Attached Files According to the Month
    Hi,
     
    I am sorry I do not quite understand what you are doing with this sentence
     
    Each month the file will only change the unnamed month, so the flow should select files based on the current month
     
    1. I think you mean, each month, you reason a file, and that file will not have the Month name in it????
     
    2. I am also not sure I understand, you say it's a file, but you have 3 files in your example, so are multiple People, submitting files all for "Current Month"??? and you want to automatically rename them to add the month in the name and then email it to people?
     
    Lastly, you said you have it scheduled, but you said
    I would like the stream to trigger automatically whenever a new file is placed in the specific OneDrive folder
    1. Trigger what stream the flow? So you do not want the flow to be scheduled you want it to run each time a file appears?
    2. Are these files bigger than 50megs?? If so the trigger will not trigger, just an FYI.
    3. Is this your personal one drive, or One drive for business
     
    Can you please clarify what you are doing?
     
    Here, however is a guess at what you want.
     
    1. Use the trigger When a File is created
    2. Create an Array, which you will be used to capture the File Names and File Contents that is returned by the Trigger
     
    3. Use Apply to each to iterate through each file returned
     
    EVERYTHING ELSE IS INSIDE the Apply to each EXCEPT the Email, depending on the answer below
    ---Based on the maxFileCount property it may return back 1-Many files
     
    4. Use the Get File Contents, to get the file contents and add it to the Array, but also give it the name you want (adding the month part)
     
    5. Use Create File, leveraging the data in the, in a different FOLDER, or else you will simply trigger the flow again.
     
    6. Question/Clarification: I don't know if you want to send 1 email per file, or 1 email with all the files, so you would need to 
    --If just 1 file per email, set the maxFileCount to 1, and in the Flow remove step 2 (the array) as you wont need it.
    --Instead just Grab the File Contents and Name within the Apply to each and attach that content directly in the Attachment property
    --and send.
     
    This means if you have 6 Files returned, you would send 6 files
    if you want to send all 6 at the same time, put the array back
    And attach them all to the Email OUTSIDE of the Apply to each, and send them.
     
    The above steps are what you would do for 1 or many. Just remember, if you make a copy of the file with a new name,
    do not use the same folder, or you will Infinity trigger the Trigger
     
     
     
     
     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
rpersad Profile Picture

rpersad 16

#2
David_MA Profile Picture

David_MA 10 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

Overall leaderboard