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 / When a new row is adde...
Power Automate
Unanswered

When a new row is added send email to person

(0) ShareShare
ReportReport
Posted on by 43

I am new to using Power Automate. I have a problem with creating a flow. I will briefly describe what I would like to do.

When a new row appear in an excel file, I would like it to automatically send an email with the file as an attachment to the person whose email address is given in this new row.

Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Karolina17 ,

     

    I don't know exactly how is your Excel table organized, but you must need (1) a column with unique values (like an ID column) and (2) a column to identify if the email was already sent by the flow. Here is a quick step-by-step about how to implement the flow.

     

    References

    Before we start, I'm sharing some articles about the topics discussed in this solution. It can be useful for you or any users that find this thread in the future:

    - Dynamic contents and expressions in Power Automate: http://digitalmill.net/2023/07/31/using-dynamic-content-in-power-automate/ 

    - Looping arrays: http://digitalmill.net/2023/07/12/using-loops-and-accessing-array-elements-in-power-automate/ 

    - Integrating Power Automate with Excel tables: http://digitalmill.net/2023/07/17/integrating-power-automate-and-excel-tables/ 

    - Inserting and updating data in Excel tables with Power Automate: http://digitalmill.net/2023/07/24/inserting-and-updating-data-into-excel-tables-with-power-automate/ 

     

    Overview

    This is how my table looks like: there is an ID column, that is used to identify the records; an email column, that must be used by the flow to populate the "Send email" action; and a "sent" column, that identifies if the email related to this record was already sent or not:

    rzaneti_1-1708375945157.png

     

    The "sent" column must not be fille by the user: the flow will automatically populate it once it sends the email.

     

    Step 1 - Configuring the trigger

    Let's start by creating a flow with the "When an item or file is modified", from SharePoint connector (you can also use it from OneDrive connector, if your file is stored in OneDrive):

    rzaneti_2-1708376070253.png

     

    Fill in with the details about your file's location (SharePoint Site, Library and folder). You may notice that there is no option to select the individual file, but only a folder to be monitored. This is expected, and technically this trigger is capturing the modification event of any file located into the folder selected by you.

     

    To ensure that the trigger will monitor only a specific file, you will need to add a trigger condition. In your trigger, select the "Settings" tab (highlighted in yellow) and add a trigger condition (highlighted in green):

    rzaneti_3-1708376282769.png

     

    The condition must be the following: @equals(triggerBody()?['{FilenameWithExtension}'], 'emails to send.xlsx'), where you must to replace the text in red for the name with extension of the Excel file where your table is stored.

     

    Although the trigger is monitoring changes happening in any file allocated in the folder selected by you, the flow will be triggered only if a change is made in your Excel file

     

    Step 2 - Capturing the new table records

    Now it's time to add a "List rows present in a table" action. Populate it with the details of your flow and add a filter query to capture only the records where the column "sent" is empty: 

    rzaneti_4-1708376458516.png

     

    The filter query text is sent eq '', and you must replace the text in red for the name of the column that you are using to register that an email was sent to the record.

     

    This control is important to ensure that you won't be sending emails to old records. By default, Power Automate will retrieve all records from the table, and it won't be able to identify the new records included during the recent file changes. Once you insert a column to perform this control, Power Automate will be able to filter out all of the records that already had an email sent in the past (by using the filter query from above), and retrieving only the new records added to the table. 

     

    Step 3 - Sending the email

    Power Automate returned only the new records added to the table, so you can loop them all with a "For each" or "Apply to each" and add your email action inside it. For this example, I'm using a "Compose" action just to display the email of the current loop iteration, but you can replace it for a "Send email" and populate the "To" input with the dynamic content of "email": 

    rzaneti_5-1708376975072.png

     

    Also, you must allocate an "Update a row" action inside the loop, to register in the table whenever the email is sent to the user. Just populate the action with the table details, set the "id" as "Key column" (highlighted in yellow), set the "id" dynamic content as "Key value" (highlighted in blue) and set the "sent" column as "Yes" (highlighted in green):

    rzaneti_7-1708377208174.png

     

    Testing the flow

    The flow is complete. I've included a new row into the table for testing, without filling the "sent" column:

    rzaneti_6-1708377165605.png

     

    As expected, the flow ran and identified retrieved only one record from Excel (highlighted in yellow), which email is test1@test.com (highlighted in green):

    rzaneti_8-1708377366200.png

     

    And after that, the flow automatically updated the "sent" column to "Yes":

    rzaneti_9-1708377434436.png

     

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 
    https://www.linkedin.com/in/raphael-haus-zaneti/ 

  • Karolina17 Profile Picture
    43 on at

    Hi, thank you for your help. I have a problem with the fact that messages are sent several times, I added a condition but it doesn't work.

    Karolina17_0-1708412138214.png

     

  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Karolina17 ,

     

    What do you have as input for the condition?

  • Karolina17 Profile Picture
    43 on at

    I have this as input

    Karolina17_1-1708432477167.png

     

  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Karolina17 ,

     

    As you are using the condition to filter out the records where you already have a "TAK" in the "sent" column, make sure that the "TAK" in Excel is in upper case (Power Automate will be case sensitive for this comparison), and without any extra blanks at the beginning or end of the text.

     

    Alternatively, you can use an expression to test if the "sent" column is empty and, if yes, send the email and run the update action. This works fine for any text added to "sent" column, ignoring the letters case and the extra blanks:

    rzaneti_0-1708471031646.png

     

    Expression: empty(items('For_each')?['sent']), and make sure to change the items('For_each')?['sent'reference to your actual "sent" column dynamic content.  

     

    Note: by applying this change, make sure to move your "Send email" and "Update row" actions to the "True" block of the Condition.

     

  • Karolina17 Profile Picture
    43 on at

    @rzaneti I added this condition, but after 1 minute I sent the same message again with this flow.

    Karolina17_0-1708494948296.pngKarolina17_1-1708495159110.png

     

  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Karolina17 ,

     

    The Excel "List rows present in a table" requires some minutes to capture file updates, so when you update a record in an run the flow after one minute, it is possible that it is using data from the previous version (in your case, without any information in the "sent" column. 

     

    Some questions:

    - Are you facing the same issue when you wait 5 minutes between two flow runs?

    - If yes, is your Excel table "sent" column updated after running the flow?

    - If not, please, share an image of your Excel table

  • takolota1 Profile Picture
    4,974 Moderator on at

    If you wanted an automated trigger, then there is also this When an Excel row is created, modified, or deleted template: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/When-an-Excel-row-is-created-modified-or-deleted/td-p/2264670

  • Karolina17 Profile Picture
    43 on at

    Hi @rzaneti,

    -After 1 test, flow sent me 2 messages as if it had started 2 times.Karolina17_1-1709270847117.png

     

    Karolina17_0-1709270224469.png

    -After 5 minutes I entered another adres email into the file, the flow started 2 times but sent 1 message.

    Karolina17_2-1709270874356.png

    - Yes, my "sent" column updated after running the flow

    Karolina17_3-1709271313410.png

    - I have also another question. In this file now I will have 3 tables. I would like this flow to start when the change occurs in first "1" sheet. Is it possible to add?

  • Verified answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @Karolina17 ,

     

    About the duplicated call, my guess is that you are getting one for the new row insertion (which is expected), and another for Power Automate "Update a row" task, which is modifying the file to include the "TAK" into the "sent" column. Ideally, this second flow run should not result in a new email sending, as we won't have any empty values in "sent" column, but it is possible to happen, as this second flow run can happen in less than 5 minutes from the file update, not capturing its changes. 

     

    A possible solution may be to change the "interval" property from your trigger, setting it to 5 minutes:

    rzaneti_0-1709296176770.png

     

     

    This property controls how often Power Automate will monitor the changes in the SharePoint folder. By setting it to a larger amount of minutes, you must prevent Power Automate to capture the old Excel file version.

     

    About limiting the flow run to changes in only one sheet, I don't think that it may be possible, as the trigger is related to a SharePoint control, and not to Excel itself.

     

    Let me know if the recommended change works for you!

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard