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 : 3jNzG91FXuXa/bnws7+1DQ
Power Automate - General Discussion
Unanswered

Power Automate send duplicate Email after excel filer query

Like (0) ShareShare
ReportReport
Posted on 12 Dec 2023 11:53:14 by 10

Hello,

Please, I need support from you where I have an Excel table with actions. I used Power Automate to send an automatic email for late actions. I used list rows present in a table, then a filter query. Then I used HTML and sent email V2.

It works successfully for filtering actions but not sending actions in one email. It sends several emails for late actions. If there are two late actions, it sends two emails for all the late actions together.

I want all late actions in one email.

 

Below screenshots: 

1: the data source table:

MohamedMohamed_0-1702378498235.png

 

2- list rows present in table with filter query:

MohamedMohamed_1-1702378649178.png

2: create HTML:

MohamedMohamed_2-1702379032202.png

3- for each

MohamedMohamed_3-1702379085032.png

4: send email V2

MohamedMohamed_4-1702379123878.png

 

5: my email:

MohamedMohamed_5-1702381866159.png

 

I have the same question (0)
  • MohamedMohamed Profile Picture
    10 on 12 Dec 2023 at 14:33:33
    Re: Power Automate send duplicate Email after excel filer query

    Thank you for your help @berilevliyaoglu 

  • berilevliyaoglu Profile Picture
    31 on 12 Dec 2023 at 14:03:40
    Re: Power Automate send duplicate Email after excel filer query

    berilevliyaoglu_0-1702388651736.png

    You need to use first() function to get the first element of the array, which the excel list row action gave you as output. In the function area, please write first(), then in between the parentheses, please click dynamic content and click EMAILS. Do the same for the SN in the subject parameter. 

    Welcome to Power Automate by the way. I tried my best to explain but if it is still unclear, you can check some tutorials which uses excel list row action. But simply; when you use list rows action, the output which you see in the dynamic content as excel column names, are arrays. For instance, EMAILS variable is an array and its elements are the corresponding values from the excel rows that you have as output (late actions). 

    In my opinion, you can have a condition checking whether the late actions belong the same email addresses or not. Because if they are different, you may want to send the same email to each recipient. However if they are same, you can send one email by using the first() function. 


  • MohamedMohamed Profile Picture
    10 on 12 Dec 2023 at 13:19:53
    Re: Power Automate send duplicate Email after excel filer query

    Thanks, @berilevliyaoglu , appreciate your support.

    I'm a beginner in Power Automate and  I do not know details.

    By removing apply to each, I received the following error:

    "Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The repetition action(s) 'For_each' referenced by 'inputs' in action 'Send_an_email_(V2)' are not defined in the template."

     

    MohamedMohamed_0-1702386928740.png

     

    Also I applied First() in 'To' and 'Subject' but I'm not sure am I right or not?

  • berilevliyaoglu Profile Picture
    31 on 12 Dec 2023 at 12:15:19
    Re: Power Automate send duplicate Email after excel filer query

    It is because "send an email" action is inside of a for each loop which executes the mail action for each excel row in the output.

     

    To prevent this, you can delete the loop and use "send an email" action alone by itself. You must edit "to" and "subject" parameters since they are forcing you to have a loop. If the late actions in the table have same email address, you can use first() function to get the email address from the first late action row. However if they could be different email addresses for the late actions, your solution makes more sense.  Similarly for the subject parameter, if you use first() function, the email subject will be the SN of the first late action. However, you can create a variable and concatenate the SN's of the late actions and use the variable for subject parameter. 

    Let me know if you require further explanation.

     

    If it helps, please mark as solution 😊

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…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 736 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 396 Moderator

#3
Power Apps 1919 Profile Picture

Power Apps 1919 339

Last 30 days Overall leaderboard
Loading complete