How to Create an HTML Table in Power Automate?

In this Power Automate tutorial, we will learn how to create an HTML table in Power Automate. We will also cover the below topic with different examples.

  • Create an HTML table in Power Automate from a SharePoint list
  • How to Create HTML Table with Border in Power Automate
  • Create a vertical html table in Power Automate
  • How to create html table formatting in Power Automate
  • Create an HTML table with custom columns in Power Automate

Recently, I got a requirement to send SharePoint list items in an HTML table format in an email using Flow. So, for that, I have used the below SharePoint Online list having the columns like:

  • Customer Name – default title column
  • Customer Email – Single line of text
  • Contact Detail – Number type
  • Address1, Address2 – Multiple lines of text
  • State, Country– Choice type
  • Zipcode – Number type
How to Create HTML Table using Power Automate

Once users click on a button, the flow will trigger and this will get all the items from the above SharePoint list. Then it will create an HTML table with a little formatting and finally will send an email to the user.

So, let us build from scratch.

How to Create HTML Table in Power Automate from a SharePoint list

Let us see how to create an Html table from a SharePoint list in Power Automate. For this, I am going to create a button flow that will trigger manually.

  • Log in to Power Automate, then click on the Create option and select an instant cloud flow to trigger the flow manually.
Create HTML Table in Power Automate
Create an HTML Table in Power Automate
  • Click on the Next step and then select Get items action and configure the SharePoint Site address and List name. This will get all the items from the selected SharePoint list.
Power Automate Create HTML Table
  • Now click on the next step, to map the key-value pair using the ‘Select‘ data operation. Then in the ‘From box’ add the value from dynamic content. Next, we will dynamically map values by adding the key-value pair in the Map box.
  • Based on the SharePoint list columns names, we will make like this. Enter the key name in the key text box and then in the value box add the dynamic content value, like below:
Create HTML Table in Power Automate flow example
  • Now in this next step, we will create an HTML table by selecting the ‘Create HTML table‘ action from the action triggers.
  • Next in the From box, select the ‘output’ from the dynamic content for the select data operation action, and in the Columns box select Automatic.
create html table formatting in power automate

Now we will add a compose action to apply the style for the generated HTML table, for that add the below CSS code.

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 3px 2px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>
create html table formatting in power automate
  • To send an email, select Send an Email (V2) (outlook) action. In The To address pass the dynamic content user email address.
  • Then in the body add outputs of the style-composed action and HTML action from dynamic content.
Create an HTML Table in the Power Automate flow

Save and test the flow manually by selecting the run flow option.

create html table in power automate flow

Once your Flow ran successfully, in the Outlook email we can see that the HTML table has been generated and displayed the Customer’s information.

create html table in power automate

In the below screenshot, we can see that the HTML table has been generated and displayed the Customer’s information using flow.

create html table in power automate from sharepoint list

This is how to create an Html table from the SharePoint list in Power Automate.

Create an HTML table with custom columns in Power Automate

Let us see how to create an HTML table with custom columns in Power Automate.

Here we will use the same SharePoint list, but we will add 3 custom columns in the HTML table. We will use the Customer list and custom columns to display the customer name, customer email, and contact detail.

  • Follow the above approach to create an instant cloud flow that will trigger manually. Click on the Next step, select Get items action, and configure the SharePoint Site address and List name. We use the Get items flow action to get all the items from a SharePoint Online list.
Create an HTML table with custom columns in Power Automate
  • Then select the ‘Create HTML table‘ action to create an HTML table. Next in the From box, pass the values of dynamic content, and in the Columns box select Custom.
  • Add the column header for the customer name, customer email, and contact detail, and pass the dynamic value from the SharePoint list in the Values column.
Create HTML table custom columns example power automate

To apply style for the created HTML table and add the below CSS code in the Compose action.

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 3px 2px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: orange;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>
Example to Power Automate create HTML table custom columns
  • Select Send an Email (V2) (outlook) action to send an email. Pass the dynamic content using the email address to the To address. Add Subject value in the Subject field.
  • Then in the body add outputs of the style-composed action and HTML action from dynamic content.
Create an HTML Table with custom columns in Power Automate

Save and Test the flow and run the flow by selecting the run flow option. Once your Flow runs successfully like below:

create an HTML table custom columns in Power Automate

In the Outlook email, we can see that the HTML table has been generated and displayed the Customer’s information based on the custom column that we have added.

create html table power automate custom columns

This is how to create an HTML table with custom columns in Power Automate.

How to Create HTML Table with Border using Power Automate

Here we will see how to create an HTML table with Border using Power Automate.

In this example, we will use the below displayed SharePoint Task list consisting of Task name, Assigned to, Task Priority, and Task status.

  • Task name – default title column
  • Assigned To – Person or group column
  • Task Priority and Task Status – Choice column
How to Create HTML Table with Border flow

By default when we generate a table using create an HTML table action, it will create table values without borders like the below:

Create HTML Table with Border in Power Automate
  • Now we will create an instant flow to get the values from the SharePoint list and generate an HTML table along with the borders.
  • Login to Power Automate, select the instant cloud flow to trigger the flow manually, and then Select Get items action to get items from the SharePoint list.
  • Then configure the SharePoint site address and list the name as below:
Create HTML Table with Border in flow

Add a select action and pass the dynamic value in the from field. In the Map section map the table row and table data values.

Create HTML Table with Border in power automate flow

Add another select action from the action trigger and switch it to the text mode and map the dynamic value of the select action.

How to Create HTML Table with Border in power automate flow

To create an HTML table and a compose action and pass the below code to generate a table along with rows and data values. For that use the join expression to get data from the previous action.

<table>
<tr>
<th>TaskName</th>
<th>Assigned To</th>
<th>Task Priority</th>
<th>Task Status</th>
</tr>
@{join(body('Select_2'),'')}
</table>
create html table with borders in power automate

To display the HTML table with a border, add a compose action and inject the below CSS code.

<style>
table, th, td {
  border: 1px solid;
}
th {
  background-color: #04AA6D;
  color: white;
}
th, td {
  padding: 15px;
  text-align: left;
border-bottom: 1px solid #ddd;
}
</style>
create html table with borders in power automate
  • Select Send an Email (V2) (outlook) action to send an email. Pass the dynamic content using the email address to the To address. Add Subject value in the Subject field.
  • Then in the body add outputs of the style-composed action and HTML action from dynamic content.
power automate create html table with borders

Save and test the flow by selecting the run flow option. Once the flow ran successfully like below:

power automate create html table with borders

In the email, we can see HTML table has been generated and displayed the table with a border.

Create HTML Table with Border in power automate

This is how to create an HTML table with Border using Power Automate.

Create a vertical html table in Power Automate

Let us see how to create a vertical html table in power automate.

In this example, we will use the SharePoint TaskList, and we will generate the HTML vertical table with values.

  • Login to Power Automate, select the instant cloud flow to trigger the flow manually, and then Select Get items action to get items from the SharePoint list.
  • Then configure the SharePoint site address and list the name as below:
create vertical html table in power automate
  • Choose the select action from the action, to get the value for TaskName, Assigned To, TaskPriority, and TaskStatus.
  • In the From section, pass the values from dynamic content.
  • And For the TaskStatus value use the below expression to concat in the select action:
concat('<td>',item()?['Status/Value'],'</td>')
create vertical html table in power automate

Now Add a compose action and generate an HTML table by adding the below code, use the join function to get the row values.

join(body('Row_4'),'')
<table>
<tr><td style='background-color: #d9c9c7;'>TaskName</td>@{join(body('Row_1'),'')}
</tr>
<tr> <td style='background-color: #d9c9c7;'>AssignedTo</td>@{join(body('Row_2'),'')}
</tr>
<tr> <td style='background-color: #d9c9c7;'>TaskPriority</td>@{join(body('Row_3'),'')}
</tr>
<tr> <td style='background-color: #d9c9c7;'>TaskStatus</td>@{join(body('Row_4'),'')}
</tr>
</table>
Example to Create HTML Table Vertical using power automate flow

Add a compose action and inject the below CSS code to display the HTML with a border

<style>
table, th, td {
  border: 1px solid;
}
th {
  background-color: #04AA6D;
  color: white;
}
th, td {
  padding: 15px;
  text-align: left;
border-bottom: 1px solid #ddd;
}
</style>
Create HTML Table Vertical using power automate flow
  • Select Send an Email (V2) (outlook) action to send an email. Pass the dynamic content using the email address to the To address. Add Subject value in the Subject field.
  • Then in the body add outputs of the style-composed action and HTML action from dynamic content.
Create HTML Table Vertically using flow

Save and test the flow by selecting the run flow option. Once the flow ran successfully like below:

How to Create HTML Table Vertically

In the email, we can see HTML table has been generated and displays the table data value vertically.

How to Create HTML Table Vertically example

This is how to create HTML Table vertical using Power Automate flow.

HTML Table Formatting in Power Automate

Let us see how to create an HTML table and do some formatting in Power Automate.

  • Create an instant cloud flow to trigger the flow manually, and then Select the Get items action to get items from the SharePoint list and configure the SharePoint site address and list the name as below:
How to Create HTML Table Formatting using Power Automate
  • Now click on the ‘Select‘ data operation. Then in the ‘From box’ add the values from dynamic content. Next, we will dynamically map values by adding the key-value pair in the Map box.
  • Enter the key name in the key text box and then in the value box add the dynamic content values, like below:
  • To apply formatting for the Task Status column use the below expression:
<p style="color:@{if(equals(item()?['Status/Value'],'Completed'),'green','red')};">@{item()?['Status/Value']}</p>
Create HTML Table Formatting in Power Automate
  • Now we will create an HTML table by selecting the ‘Create HTML table‘ action from the action triggers. Next in the From box, select the ‘output’ from the dynamic content for the select data operation action.
HTML Table Formatting in Power Automate

Add a compose action and inject the below CSS code to apply the border for the generated HTML table.

<style> table, th, td {
  border: 1px solid;
} </style>
Example to Create HTML Table Formatting using Power Automate flow

Add another compose action to clean up the HTML of the create HTML action, use the below-mentioned expression.

replace(replace(replace(replace(replace(body('Create_HTML_table'), '&lt;', '<'), '&gt;', '>'), '&amp', '&'), '&#39;', '"'), '&quot;', '"')
HTML Table Formatting in Power Automate
  • Select Send an Email (V2) (outlook) action to send an email. Pass the dynamic content using the email address to the To address. Add Subject value in the Subject field.
  • Then in the body add outputs of the style-composed action and HTML action from dynamic content.
create html table formatting in power automate

Save and test the flow by selecting the run flow option. Once the flow ran successfully like below:

Example to Create HTML Table Formatting using Power Automate flow

In the email, we can see HTML table has been generated and displays the formatted table status value based on the condition applied.

create html table formatting in power automate

This is how to create an HTML table and do some formatting in Power Automate.

Conclusion

Creating an HTML table in Power Automate and we saw it by doing examples on how to create an HTML table in Power Automate from a SharePoint list. We will also cover the below topic with different examples.

  • Create an HTML table in power automate from the sharepoint list
  • Create HTML table in Power Automate custom columns
  • How to Create HTML Table with Border in Power Automate
  • How to Create an HTML Table and Do Formatting in Power Automate
  • Create a vertical html table in Power Automate

You may also like:

>