Skip to main content
Community site session details

Community site session details

Session Id : qIZtPMwGg9Q0JNbB+7I2E/
Power Automate - Building Flows
Unanswered

Sending multiple list items from Excel in a single mail

Like (0) ShareShare
ReportReport
Posted on 24 Sep 2020 14:51:31 by 11

Hello Community,

 

I am trying to create a flow where my goal is to send a single email after filtering and grouping the data based on a condition (Client ID) from multiple rows in Excel. I followed the exact same steps as this article suggest - meaning the data is aggregated in a HTML table - and it is almost perfect, expect that I receive the same amount of emails as the rows of the table.

The condition is working and the extracted content is correct, but if I have 5 rows I get 5 emails about the same. I suppose its because of the 'apply to each' action, but I don't think it can be skipped.

 

So my goal would be to have these emails sent but only once.

Do you happen to know how I could make it work?

 

Thank you in advance.

  • Goromi Profile Picture
    11 on 28 Sep 2020 at 09:02:06
    Re: Sending multiple list items from Excel in a single mail

    Hello @ChristianAbata ,

     

    Thank you for the advice. I've modified the script but unfortunately it is still flawed.

    The recipients as dynamic content are less important so let's focus on table creation and the mail sending.

     

    After I took out the 'send mail' action from the 'do-until' loop it truly sends only one email, but the the tables are still generated as many times as the number of the rows. In this example you can see that the first customer has 3 items and there 3 tables under each other. (If it was 7 item, there would be 7 tables)

    current error.PNG

    What I would need is to have the script create the table, but only once and when the table is created after X loop, then it should send one email (about those X items). After the mail is sent, the script should jump back into the loop, create another table again for the next customer's data and send another email about the next created table and so and so on until the end of the file.

    As I mentioned the file currently contains about 200 rows and roughly 60 customer's data. At the end, I expect to receive 60 emails.

     

    I was thinking about defining the number of loops somehow, but unfortunately the number of items assigned to a customer is random (between 1-10 items), so it changes each time.

     

    Can you advise how to make it work? Is it even possible to create a script for this scenario?

    Thank you in advance.

  • ChristianAbata Profile Picture
    8,949 Most Valuable Professional on 25 Sep 2020 at 13:08:48
    Re: Sending multiple list items from Excel in a single mail

    @Goromi  excellent friend good flow.

     

    And the reason why you are receiving lots of emails ie because your send and email is inside your loop do until.

     

    I recomend you to use another string variable outside the loop and then use apend string variable inside the loop to save your table output.

     

    Then outside the loop create your send an email action and use the variable that you recently create that contents now your table.

     

    See this is another example with the same result.

     

    variables.PNG

     

    whar the user wants to do is send and email by adding all the names users so the flows add everything in a variable and outside the loop the user can just use the data 

  • Goromi Profile Picture
    11 on 25 Sep 2020 at 09:32:08
    Re: Sending multiple list items from Excel in a single mail

    Hello @ChristianAbata

    Of course, find the script below.
    The principle is to group the content of the table based on the client ID, extract those rows, create an HTML table and send it by email. This file is quite big, containing about 200 rows.
    As you can see its almost good, I got the filtered content, but the problem is that I receive the same number of emails as the rows of the table - and if there is 3 rows about the same customer, I receive the same email 3 times. I suppose its because of the apply to each action.
    Ultimately, we would like to fetch the email addresses also from the Excel - using dynamic content - if its possible. If not, its okay if we can only send it to a non-dynamic content address.
    Could you help me to build this flow?
    Thank you in advance.

     

    Flow structure.pngflow outcome.PNG

  • ChristianAbata Profile Picture
    8,949 Most Valuable Professional on 24 Sep 2020 at 19:36:36
    Re: Sending multiple list items from Excel in a single mail

    @Goromi  could you share us a screenshot?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1

Loading complete