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 / Send Email once when f...
Power Automate
Answered

Send Email once when files are uploaded sharepoint

(0) ShareShare
ReportReport
Posted on by

Hi, 

I am using the template provided by Power automate. However, the issue is that when 30-50 files & folders are uploaded to the Sharepoint, i will receive 30-50 emails. Is there anyway to set an email (Summary of the files + folders uploaded) to be sent at the end of the day like 6PM? 

 

I am new to Power Automate

 

Screenshot (322)_LI.jpg

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @PA_is_awesome1 ,

     

    This template cannot meet your needs.

    To achieve it, you should create a scheduled flow.

    You can set the trigger and the flow will be triggered every day at 6 pm.

    vxiaochenmsft_0-1665726399765.png

    vxiaochenmsft_2-1665726513317.png

     

    Best Regards,

    Wearsky

  • FY-11021246-0 Profile Picture
    on at

    Hi @v-xiaochen-msft ,

    Thanks for the solution and apologies that i wasn't specific.

    Based on the solution, an email will be sent daily. However, i would only like a summary email to be sent if documents were uploaded. The folder will be shared by different departments and it is not daily that we will have documents being uploaded. 

     

    Once again, thank you. 

  • v-xiaochen-msft Profile Picture
    on at

    Hi @PA_is_awesome1 ,

     

    Assuming x files are uploaded today, if you use 'when a file is created' trigger, the flow will be triggered x times. That's by design.

    If you want avoid the duplicate flow run, the scheduled flow is the best choice.

    You can add a 'get files' action to get the files uploaded today with filter. 

    If there are no files uploaded today, the flow will not send any email. To achieve it, please add a condition in flow.

     

    vxiaochenmsft_1-1665731327625.png

    Hope it makes sense.

     

    Best Regards,

    Wearsky

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    Note if you want to run the report at 6PM each day then you can't just get the files and folders created today otherwise you won't get anything created after 6PM each day.

     

    See summary of flow below that runs daily at 6PM and retrieves files and folders created in the last 24 hours. I'll go into detail for each action below the summary.

     

    grantjenkins_0-1665750422980.png

     

    Recurrence

    This is set to run at 6PM each day based on my time zone (you would put whatever time zone you are in).

    grantjenkins_1-1665750509977.png

     

    Initialize variable - Last 24 hours

    This creates a date set to the current time minus a day so 24 hours ago.

     

    addDays(utcNow(),-1)

     

    grantjenkins_2-1665750623981.png

     

    Get files (properties only)

    This retrieves all the files (and folders) where the created date is greater or equal to 24 hours ago (the last time you ran the report). It also has Include Nested Items set to Yes.

     

    Created ge '@{variables('OneDayAgo')}'

     

    If you wanted to only return files (NOT folders) then you could update the Filter Query with the following:

     

    FSObjType eq 0 and Created ge '@{variables('OneDayAgo')}'

    grantjenkins_2-1665751837004.png

     

     

    Condition - Are there any files

    This checks to see if any files and/or folders were returned (created in the last 24 hours) and only continues if there is at least one.

     

    length(outputs('Get_files_(properties_only)')?['body/value'])

     

    grantjenkins_4-1665750938231.png

     

    Create HTML table

    This will build an HTML table passing in the relevant fields from the files returned. You can add whatever fields you want (that are available to you). Note that value in the From field is taken from the Get files action.

    grantjenkins_5-1665751082055.png

     

    Compose Table Style

    This is some CSS (Cascading Style Sheet) to style your table to make it look nice when it's sent out via email.

     

    <style>
    table {
     border-collapse: collapse;
     width: 100%;
    }
    table td, table th {
     border: 1px solid #ddd;
     padding: 8px;
    }
    table tbody tr:nth-child(2n+2) {
     background-color: #ddd;
    }
    table tr:hover {
     background-color: #ddd;
    }
    table th {
     padding-top: 12px;
     padding-bottom: 12px;
     text-align: left;
     background-color: #1C6EA4;
     color: white;
    }
    </style>

     

    grantjenkins_6-1665751191759.png

     

    Convert time zone

    This just takes the date/time from 24 hours ago and converts it into my time zone with a full date/time pattern. Again, you would change this to your time zone. This is used in the email subject and body.

    grantjenkins_7-1665751267077.png

     

    Send an email - Daily summary

    Finally you send the email including the converted date/time, CSS table style and HTML Table you generated.

    Note that the first Output is from Compose Table Style, and the second Output is from Create HTML table.

    grantjenkins_0-1665751509911.png

     

    Below is an example of what the email would look like.

    grantjenkins_1-1665751776964.png

     

  • FY-11021246-0 Profile Picture
    on at

    Dear @grantjenkins ,

    Sorry for the late response as i was away. I have tried it and this is exactly what i need ! 

    Thank you so much for going through it step by step. It really help me as i am totally no clue on the rationale behind it. It is always why i tend to use Template which was already set up. 

    This is brilliant. Thank you !

  • FY-11021246-0 Profile Picture
    on at

    Dear @v-xiaochen-msft ,

    I would like to thank you for the time. 

  • FY-11021246-0 Profile Picture
    on at

    Hi @grantjenkins  ,

    Hope you have been well.  

     

    My team has started using this solution. Along the way, i found it hard to manage the individual 50 project folders due to the changes in the team members. I don't think there will be any solutions to manage the specific folder in each project?

     

    But are we able to pull the email addresses from an excel instead of logging into the specific folder to amend the change in team member's email address? 

    I have uploaded a screenshot of the excel.

    PA_is_awesome1_0-1670305604337.png

     

     

    Main Email address will be at the “To”

    Back-up Email address will be at the “CC”

    PA_is_awesome1_1-1670305604340.png

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    One thing you'd need to do is convert your data in Excel to an Excel Table so that you can retrieve it within Power Automate. Something like below:

    grantjenkins_0-1670310162473.png

     

    Then, wondering how you would map a project to the relevant row in your Excel Table. Are the Project Folders in SharePoint named the same as your Project Names in your Excel Table?

  • FY-11021246-0 Profile Picture
    on at

    Hi @grantjenkins ,

    Yes, we can name the Project Name to be the same as the SharePoint Folder Name. 

    Thanks for the pointer on converting the Excel into Table. Thank you !

  • Bugs15 Profile Picture
    2 on at

    Hi @grantjenkins

    Thank you very much for providing this solution. I want to make 2 adjustments, one is modified date and number of times the file was saved/modified. Modified date was straightforward but the format is like "2024-06-21T13:23:48Z", can it be made changed to exclude the "T" & "Z"?
    And I have no idea how to get the number of times the file was saved/modified info in the table. Would you be able to help?

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard