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 :
Power Platform Community / Forums / Power Automate / how to send an email w...
Power Automate
Unanswered

how to send an email with a personalized HTML table to each ID

(0) ShareShare
ReportReport
Posted on by

Hi everyone! I am a beginner with Power Automate Flows and I need some help creating my first flow. 

So my input is an excel file organized as shown: Ex power automate.png

The output I want is to send a single email to each 'name ID' containing an HTML table with all the data related to the 'name ID' I'm sending the email to. 

What I have done so far is creating a HTML table for each 'UniqueIDs', but each table contains data from the all dataset, which means that is not personalized for each 'UniqueIDs'.Help 1.pngHelp 2.png

What step am I missing? Thanks

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at
    Re: how to send an email with a personalized HTML table to each ID

    Inside your Apply to each you'll need to use a Filter array to filter out only the items where the Name ID is equal to the Current item, then use the output from the Filter array to create your HTML table.

     

    The expression to get the current Name ID you are iterating over (based on what you currently have) is below:

     

    items('Apply_to_each')?['EmailIDs']

     

    grantjenkins_0-1681728515429.png

     

  • Community Power Platform Member Profile Picture
    on at
    Re: how to send an email with a personalized HTML table to each ID

    What should I select as the input of the filter array? the body output from select function?

     

  • Community Power Platform Member Profile Picture
    on at
    Re: how to send an email with a personalized HTML table to each ID

    This is what I did under filter array, but is not working 

    Help PA.png

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at
    Re: how to send an email with a personalized HTML table to each ID

    Below is how I would get what you're looking for. Just a few slight changes to what you already have.

     

    For this example, I'm using the following Excel Table.

    grantjenkins_0-1681737994075.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1681738105305.png

     

    List rows present in a table retrieves the rows from our Excel Table.

    grantjenkins_2-1681739659493.png

     

    Select maps the NameID and the Email.

    grantjenkins_3-1681739704128.png

     

    Style HTML table is a Compose action (I just renamed it) that contains some CSS for styling our HTML table (make it look nicer in the email).

    <style>
     table {
     border-collapse: collapse;
     }
     table td,
     table th {
     border: 1px solid #ddd;
     padding: 6px 20px;
     text-align: left;
     }
     table th {
     background-color: #1C6EA4;
     color: white;
     }
    </style>

    grantjenkins_4-1681739789253.png

     

    Apply to each iterates over each unique NameID/Email. It uses the union expression directly in the input (don't need to create a variable for this).

    union(body('Select'), body('Select'))

    grantjenkins_5-1681739885542.png

     

    Filter array uses the output from List rows present in a table and filters on NameID equals the current NameID we are iterating over. See expression below.

    items('Apply_to_each')?['NameID']

    grantjenkins_6-1681739969533.png

     

    Create HTML table uses the output from Filter array and maps each of the fields we want to show in our HTML table. IMPORTANT: The field names you use here should match exactly what you have in your Excel Table.

    //Name ID
    item()?['Name ID']
    
    Invoice Number
    item()?['Invoice num']
    
    Order Number
    item()?['Order num']
    
    //Additional fields
    item()?['Field Name']

    grantjenkins_11-1681740667591.png

     

    Send an email uses the output from Style HTML table and Create HTML table in the Body. And it uses the following expressions to get the NameID and Email.

    //To (Email)
    item()?['Email']
    
    //Greeting (Hi Lara,)
    item()?['NameID']

    grantjenkins_8-1681740324918.png

     

    Below are the emails that would be sent out in this example.

    grantjenkins_14-1681740790158.png

     

    grantjenkins_15-1681740803849.png

  • MB35 Profile Picture
    91 on at
    Re: how to send an email with a personalized HTML table to each ID

    Hi,this has helped so much with some work I am doing, thankyou! my sticking point now is that for each table I'm sending there are additional delegates to copy in on the email. Within my excel table i have upto 3 separate email addresses per row who will need to receive the same email as the original person.  So one email to 4 people for example. Any idea how I add this in to the flow you have provided? Thanks, Michelle 

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard