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.
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)
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.
@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.
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
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.
@Goromi could you share us a screenshot?
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1