cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
littlek
Frequent Visitor

Sending Scheduled Emails with Excel Rows Included

I am new to Microsoft Flow/Power Automate and I am trying to work on a project with it. I have been experimenting with it but I am still getting issues.

 

My goal is to send emails to specific people in my company at the end of the day or week ever day or week.

 

The email needs to contain the data from rows in an excel sheet.

 

There are new rows added daily and the email should only send the most recent rows.

There is a data field in the excel data but idk if that could be used to determine which rows to send?

 

I would also like to send all the rows related to one person under a single email.

Right now when I send it every row comes in as a separate email, which I could see being very irritating for people.

 

Here is my current flow:

Flow1.JPG Flow2.JPG

 

What is wrong with my Flow?

How do I get it to do what I want?

 

Please Help!

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @littlek ,

 

As @edgonzales  suggested, please try the following configuration:

Spoiler
56.PNG57.PNG58.PNG59.PNG

And you could add more rows in Condition control to filter rows.

Feel free to let us know if you have any other questions.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
edgonzales
Super User II
Super User II

@littlek 

Hi there.  So, what your flow is doing is going once a week to that spreadsheet and getting all of the rows (let's pretend you have 10 rows).  One of the columns of that spreadsheet is "Customer eMail", so when you drop that in the "To" field, flow presumes they'll all be different and automatically creates an "Apply to each" loop for you (note the gray box).

 

So, what it's doing is moving through all of the rows, one at a time, and 'doing the thing'...in this case, sending an email with all of that information in the body.

 

The way around this is to stage everything ahead of time by using a Select action and/or a Create HTML table.  But there's still the question of the email address...your question said you want to send it to certain people at work but the flow shows 'Customer eMail'.  Are we sending the eMail to the same people each week?  

 

It's possible to grab the list, figure out all of the 'people', and then cycle through the list to only grab their relevant rows, and shoot off an email.  It's probably an intermediate thing, but we can do it.  We would definitely want to know which rows to send (based off a "Status" field or something, right?).

 

Let me know what you think and we can get started.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

The Customer Email thing in the "To" field is more of a placeholder.

That column has the email address of all the customers.

In my case I was thinking we could make another column that has the email address of the person in the company that email would need to go to (call it Account Manager email) so that it would read the "To" field and only send the relevant emails for that person to them.

I'm not even sure if that would work though?

 

It's possible to grab the list, figure out all of the 'people', and then cycle through the list to only grab their relevant rows, and shoot off an email.  It's probably an intermediate thing, but we can do it.  We would definitely want to know which rows to send (based off a "Status" field or something, right?).

This is definitely what I want to do though.

If possible I would want to decide which rows to send based off the "Date Field" (so it will only send the last weeks worth of rows every week).

 

Thank You

@littlek 

Ok, lots to do.  The article below isn't doing exactly the same thing, but it uses some of the concepts you want (Grouping a list by a column where the data is moderately dynamic).  It might seem a bit much, at first, but read through that and see if that makes sense.  You won't be doing the part where we're adding numbers and variables; instead, you'll add the row to an array and then turn it into an HTML table to send via email at the end.

 

Group By and Sum in Power Automate / Flow

 

Keep at it.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

 

 

Hi @littlek ,

 

As @edgonzales  suggested, please try the following configuration:

Spoiler
56.PNG57.PNG58.PNG59.PNG

And you could add more rows in Condition control to filter rows.

Feel free to let us know if you have any other questions.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-bacao-msft That makes sense.

 

Though I am having an issue where it just sends an empty email.

It seems it is reading the condition as false no matter what.

 

And when I move the "Append to array variable 2" to the "No" it just sends an email with every row in it.

I need it to only send the past 7 days worth of rows (every row has a date field).

 

It also is not not sending rows based on email.

Whatever email address is in the email field is the only address I want that particular row to send to.

 

How do I accomplish this?

 

It also tends to freeze/time out.

 

Hi @littlek ,

 

According to the configuration method provided by me, there will be at least one record in each table.

Please carefully check my configuration and pay attention to the selection of Dynamic content.

 

In addition, I have mentioned in the previous reply, if you want to filter records based on date, you can add rows to Condition to filter records.

 

If the date field type is Date, then you also need to use the expression to restore number to Date for comparison, please refer to the following thread:

https://powerusers.microsoft.com/t5/Building-Flows/Excel-file-to-list-flow-date-issue/m-p/279258#M28...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ok thank you.

I see now.

hi, I forgot to set the variable to union/find unique approver.

All sorted now.

 

Thanks you for your help @v-bacao-msft , @edgonzales ,@JohnAageAnderse 

 

@JohnAageAnderse  ( I will try your approach for next project)

 

AC_Flow_0-1595828455565.png

 

Hi @v-bacao-msft 

 

Thanks for posting this solution - would you know how to add a CC in to this flow? I have both email and CC in my table and need to include the CC as well.

 

Thank you!

@v-bacao-msft Is it possible to get the table with format? The source sheet has certain cells highlighted and would need the colours being transferred along with the text. 

 

Thanks in advance. 

Hi @v-bacao-msft thanks a lot for your instructions! 

 

Could I have your support in finding a solution for what I've basically copy+pasted from your example.

 

I have, carefully, checked each step, trying to make this instruction to work for two days now and I'm being extremely annoyed with it as it doesn't want to work. Why?

 

This is the error I receive:

Spoiler
TCop93_0-1630668735683.png

The translation of the error is here:

Unable to parse template language expressions for "Apply_to_every_2" action on row "1" and column "20567": "The template language function parameter" union "must be a comma-separated list of arrays or objects. The function was called with parameters of type "String". Please see https://aka.ms/logicexpressions#union for details on use. ”.

 

Sadly, I am unable to change the language settings due to the organizational rules. 

 

I would like to add, that I checked the union function and it's all same as per your instruction 

union(variables('Email'),variables('Email'))
 
So, I don't understand why the error message pops up while igniting the flow. I do not receive any error at the edition stage. No warnings, etc.
Spoiler
TCop93_2-1630669096819.png

 

 Could you advise kindly?

 

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,936)