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 / Sending an email conta...
Power Automate
Suggested Answer

Sending an email containing values from Excel File

(2) ShareShare
ReportReport
Posted on by 4
I am trying to build a flow that will alert teachers via email when a student in their class needs an intervention.  The table from which I am pulling data looks like the below.  
 
Student Names Teacher Email
Student 1
Email Address 1
Student 2 Email Address 1
Student 3 Email Address 2
Student 4 Email Address 3
Student 5 Email Address 3
 
So, as you can see each student is unique, but the teacher and therefore their email address, might be the same for multiple students. 
 
What I'd like to do is send an email to "Email Address 1" containing the names of Students 1 and 2.  
 
 
I'd assume it is pretty straight forward if I sent one email per row, but I don't want to send a teacher 10 different emails if they have 10 different students in need of intervention.  
 
Thanks so much, any help would be greatly appreciated!
 
Categories:
I have the same question (0)
  • Suggested answer
    trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    As stated, it is pretty straightforward but requires a handful of steps and easy to get lost on your first try.  After doing this once though, you will be able to repeat my memory (mostly).
     
    Here's the steps.  In my example, I also send an email attachment of the rows as a CSV file.  So my email body text contains a formatted html table of the same data but working with the attachment is typically the path forward but nice to see the data in the email directly.
     
     
     
    Create two variables, shown below.
     
     
    Next add an Append to array variable action.  When you reference the dynamic content EMAIL from your excel table, this will automatically add the apply to each.  Note:  your excel file content must be in a table (not a range of worksheet data).  That's how I use the List rows present in a table action.
     
     
     
    Next add a compose with the union expression.
     
     
     
     
    Next add a filter array action.  Again, this will wrap itself in an apply to each loop when you add the dynamic content from your compose union action.
     
     
     
     
    Next I am adding an html table do display the content of the attachment in the email body of the message as a table.  Yours will probably only have one column Student name.  The value is going to be the entered as an expression item()?['StudentName']
     
     
     
     
    Same thing except for a csv table.  I refer to the content from my filter array.
     
     
     
     
    Next I create a file to send as an attachment.  In my example, I just create a file name with a random number because the name of the file isn't necessarily relevant.  The file content is the body of the csv table shown below.
     
    Then I am formatting my html table with some light formatting, some spacing and a border.  Basic but easy to understand and looks good in the email.
     
     
     
     
     
    Last step, finally, sending the email.  Here in the To: field, I refer to the current item in the loop with is my list or unique email addresses from the compose union action.  The format table variable is my list of student names (for your example).  And my attachment is my csv file.
     
     
     
     
    In summary, there are two parts to this flow.  The top portion sets up the flow, the second part loops through each unique email and sends the email.
     
    Top:
     
     
     
    Bottom:
     
     
     
    ------------------------------------------------


    If this was helpful, please like and/or mark as a verified answer to help others find this too!


    Always glad to help! 💯💯💯💯💯

    Tom 

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

     

     
     
     
  • Suggested answer
    codeninja.sj Profile Picture
    115 on at
    Alternative Approach

    If you keep the data in a dataverse table, you can use custom prompt to group the records by a specific field. The below screenshot shows how I applied the groupby operation on teacher email address:



    p.s Instead of using a dataverse table, you can also pass student names and teacher email addresses as input parameter in custom prompt
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hey there!
     
    I am following up on this post sending an email containing values from excel file in this category building flows from 08/30/2024.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 2 replies and 2 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯

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

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard