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 / HTML Table based on MS...
Power Automate
Unanswered

HTML Table based on MS Forms Multi Select

(0) ShareShare
ReportReport
Posted on by 26

Hi,


I have a requirement where I need to send in an email body a table that would be dynamic based on the multi select question from MS Forms. And then, I need to be able to dynamically create as many tables as a value of a variable.

 

E.g.

If the user selects: "Option 1", "Option 3", then I need a table that would look like this (the second column needs to be empty):

Option 1 
Option 3

 

 

Then if my other variable has a value of 3, I would need the final output to look like this:

Option 1 
Option 3

 

 

Option 1 
Option 3 

 

Option 1 
Option 3

 

 

Is this at all possible?

 

EDIT: I can see that the tables do not have all borders, but the tables have two columns: one with the multi select selections and one that is empty.

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @KrzysztofKiser You can follow below steps to get multi choice select values from MS Form and build table for the email:

     

    1. Add Compose action after Get Response Details action, and use below expression. Here in the expression first replace outputs('Get_response_details')?['body/r11e08973b90a4c588aeaa2a4ebe1be37'] with your form checkbox output dynamic content

    split(outputs('Get_response_details')?['body/r11e08973b90a4c588aeaa2a4ebe1be37'],',')

    2. Add Initialize Variable action of type String and name as EmailContent

    3. Add Apply to each action and select output from the Compose action which we added in step 1 

    4. Inside apply to each action, add Compose action with following expression:

    replace(replace(replace(items('Apply_to_each'),'"',''),'[',''),']','')
    

    5. Under compose action add Append to array variable action and configure it as shown in below screenshot, here you will use output of compose action added in step 4

    annajhaveri_3-1659075667369.png

    <tr><td valign="bottom" style="border:solid windowtext 1.0pt;padding:2px 5.4pt 0cm 5.4pt;height:15.0pt;padding-top:5px;padding-bottom:5px;width:20%">@{outputs('Compose_2')}</td><tr>

    6. In Send email action, click on the code button in body parameter (last button in the toolbar). Use the Email content variable in the Send Email action as shown below:

    annajhaveri_4-1659075993081.png

    Below is the HTML 

    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"&gt;&lt;head&gt;&lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)">
    <head>
    <style>
    table{
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
    }
    td th{
    border: 1px solid #dddddd
    text-align:left;
    padding: 8px;
    }
    </style>
    </head>
    <body>
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="623" style="width:467.5pt;margin-left:-.15pt;border-collapse:collapse">
    @{variables('EmailContent')}
    </table>
    </body>
    </html>

     

     

     

     

     

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @KrzysztofKiser You can follow below steps to get multi choice select values from MS Form and build table for the email:

     

    1. Add Compose action after Get Response Details action, and use below expression. Here in the expression first replace outputs('Get_response_details')?['body/r11e08973b90a4c588aeaa2a4ebe1be37'] with your form checkbox output dynamic content

    split(outputs('Get_response_details')?['body/r11e08973b90a4c588aeaa2a4ebe1be37'],',')

    2. Add Initialize Variable action of type String and name as EmailContent

    3. Add Apply to each action and select output from the Compose action which we added in step 1 

    4. Inside apply to each action, add Compose action with following expression:

    replace(replace(replace(items('Apply_to_each'),'"',''),'[',''),']','')
    

    5. Under compose action add Append to array variable action and configure it as shown in below screenshot, here you will use output of compose action added in step 4

    annajhaveri_3-1659075667369.png

    <tr><td valign="bottom" style="border:solid windowtext 1.0pt;padding:2px 5.4pt 0cm 5.4pt;height:15.0pt;padding-top:5px;padding-bottom:5px;width:20%">@{outputs('Compose_2')}</td><tr>

    6. In Send email action, click on the code button in body parameter (last button in the toolbar). Use the Email content variable in the Send Email action as shown below:

    annajhaveri_4-1659075993081.png

    Below is the HTML 

    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"&gt;&lt;head&gt;&lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)">
    <head>
    <style>
    table{
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
    }
    td th{
    border: 1px solid #dddddd
    text-align:left;
    padding: 8px;
    }
    </style>
    </head>
    <body>
    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="623" style="width:467.5pt;margin-left:-.15pt;border-collapse:collapse">
    @{variables('EmailContent')}
    </table>
    </body>
    </html>

     

     

     

     

     

     

  • KrzysztofKiser Profile Picture
    26 on at

    Hi @annajhaveri

     

    Thanks so much for this, but I have two problems with the table. 

    One is that the table looks different in Outlook on the Web and in Outlook Desktop. 

     

    Desktop: 

    Table-Outlook Desktop.PNG

     

     

     

     

     

     

    Web:

    Table-Outlook Web.PNG

     

     

     

     

     

    Any idea what the reason for this could be? The web version looks good, while the desktop doesn't.  

     

    And the second thing is that the table has only one column (the one with the data). I need the table to have one empty column to the right of the one with data. How could I achieve this? 

     

     

    Also, any ideas on how I could add as many such tables in the email as a number stored in a variable? 
    If the variable has a value of 2, then I'd like two table one under another in the email. Is this possible? 

     

    Thank you! 

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

#2
Tomac Profile Picture

Tomac 425 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard