How to Create an HTML Table from an Array in Power Automate + Formatting

Do you want to know how to create an HTML table from an Array in Power Automate? Yes, then you are at the right place.

In this Power Automate tutorial, I will show you how to create HTML table from an array in Power Automate step by step.

Moreover, I will explain how to create an HTML Table from a SharePoint list in Power Automate with various table stylings.

How to Create an HTML Table from an Array in Power Automate

Here, I will explain how to create HTML table from an array in Power Automate. To achieve this, follow the steps below.

1. Open the Power Automate home page, click on + Create -> Select the Instant cloud flow -> Enter the flow name and choose the trigger’s flow (Manually trigger the flow).

Power Automate create HTML table from an Array

2. Next, add the ‘Initialize variable’ flow action to set the array to create an HTML table and set the required field.

  • Name: Provide the name of the variable.
  • Type: Select the type of the variable as Array.
  • Value: Provide the array value as shown below
[
  {
    "Employee Name": "Alex",
    "Employee Experience": 2,
    "Employee Department": "Finance"
  },
  {
    "Employee Name": "Michel",
    "Employee Experience": 3,
    "Employee Department": "Development"
  },
  {
    "Employee Name": "Ruby",
    "Employee Experience": 3,
    "Employee Department": "Finance"
  }
]
How to create HTML table from an array in Power Automate

3. For formatting and presenting data in a structured manner, add the ‘Create HTML table’. Set the required fields.

  • From: Here, I have given EmployeeDetails from dynamic content.
  • Columns: Select the type of columns.
Create HTML table in Power Automate from an Array

4. Now it’s time to Save and Test. Test it Manually -> Then the Create HTML table flow action will display the output according to the value of an array.

Power Automate create HTML table from an Array

This is how to create HTML table in Power Automate from an Array.

Create HTML table from Filter Array in Power Automate

Let’s see how to creates HTML table from filter array in Power Automate.

The “Filter array” action is typically used when you want to narrow down a list of items based on certain conditions. It is commonly used to select specific elements from an array or list.

To achieve this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page, click on + Create -> Select the Instant cloud flow -> Provide the flow name and choose trigger’s flow (Manually trigger the flow).

2. To store the text value during the flow, add the ‘Initialize variable’ flow action and set the required fields.

  • Name: Provide the name of the initialized variable.
  • Type: Select the variable type as Array.
  • Value: Here, I have populated the value with the array.
[
{
"Product Name":"Gear lever",
"Product ID":"4567G"
},
{
"Product Name":"Oil Filter",
"Product ID":"1184O"
},
{
"Product Name":"Suspension",
"Product ID":"931S"
}
]
Create HTML table from filter array in Power Automate

3. Next, add the ‘Filter array’ flow action to narrow down a list of items based on certain conditions and provide all the details.

  • From: Select the Output of Initialize variable action from Dynamic content.
item()?['Part ID'] is equal to 1184O

where 1184O is the Part ID.

Power Automate create HTML table from filter array

4. Add the ‘Select’ flow action to transform or select specific properties from an array of objects and set the required fields.

  • From: Here, I have selected the Body of the Filter array action from dynamic content.
  • Map: Provide a value to define how you want to shape each object in the array.
{
"Part Name":@{item()?['Part Name']} ,
"Part ID":@{item()?['Part ID']}
 
}
How to create HTML table from filter array in Power Automate

5. Now, add the ‘Create HTML table’ flow action for formatting and presenting data in a structured manner and set the required fields.

  • From: Here, I have given the Output of the Select flow action from Dynamic content.
  • Columns: Select the type of column you want to display in the HTML table.
Power Automate example to create HTML table from filter array

6. Now, it’s time to Save and Test -> Click on Test and test it Manually -> Then the Create HTML table flow action displays the output as shown below.

Example how Power Automate create HTML table from filter array

This is how to create an HTML table in Power Automate from a filter array.

How to Create HTML Table in Power Automate

Here, I will show how to create an HTML table in Power Automate using the HTML expression.

To achieve this, follow the steps below.

1. Open Power Automate using https://make.powerautomate.com in your browser -> Click on + Create -> Select the Instant cloud flow -> Provide the flow name and choose the trigger’s flow (Manually trigger the flow).

2. Next, add the ‘Compose’ flow action to provide an HTML expression to get the desired columns in the HTML table.

concat('<table border="1"><tr><th>Employees Name</th><th>Employees Age</th><th>Employees Department</th><th>Employee Joining Date</th></tr>',
    '<tr><td>John</td><td>30</td><td>IT</td><td>2023-01-15</td></tr>',
    '<tr><td>Alice</td><td>28</td><td>Marketing</td><td>2023-01-20</td></tr>',
    '<tr><td>Bob</td><td>35</td><td>Finance</td><td>2023-02-05</td></tr>',
    '<tr><td>Charlie</td><td>32</td><td>HR</td><td>2023-03-10</td></tr>',
    '<tr><td>Diana</td><td>27</td><td>Development</td><td>2023-04-15</td></tr>',
    '<tr><td>Eva</td><td>31</td><td>Testing</td><td>2023-05-20</td></tr>',
'</table>')
  • Concat = The Concat function is used to concatenate multiple strings together.
  • Employees Name, Employees Age, etc. = contains headers for the columns: “Employees Name,” “Employees Age,” “Employees Department,” and “Employee Joining Date.”
  • Subsequent rows = represent individual records. Each row includes data for “Name,” “Age,” “Department,” and “Joining Date.
  • Closing Tags= ‘</table>’): This marks the end of the HTML table.
Power Automate Create HTML Table

3. Add the ‘Send an email (V2)’ flow and set all the required details:

  • To: Provide the email address of the user whom you want to send.
  • Subject: Enter the purpose of the email.
  • Body: Here, I have given the output of the Compose action.
Create HTML table in Power Automate

4. Now, click Save and Test -> Then test it Manually -> Inside the Run flow tab, click on Run flow. Then, open the inbox in your Outlook, displaying the output according to the HTML expression.

How to create HTML table in Power Automate

This is how we can create an HTML table in Power Automate.

How to Create HTML Table with Border in Power Automate

Let’s create an HTML table with Border in Power Automate. For this, I have used an HTML code to implement this.

To achieve this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page; click on + Create -> Select the Instant cloud flow -> Provide the flow name and choose the trigger’s flow (Manually trigger the flow).

2. Next, add the ‘Compose’ flow action to set the expression to provide the borders to the HTML table.

<table style="border-collapse: collapse; width: 100%; border: 2px solid #4CAF50; margin: 20px;">
    <thead>
        <tr style="background-color: #4CAF50; color: white;">
            <th style="border: 2px solid #4CAF50; padding: 12px;">Name</th>
            <th style="border: 2px solid #4CAF50; padding: 12px;">Age</th>
            <th style="border: 2px solid #4CAF50; padding: 12px;">Department</th>
        </tr>
    </thead>
    <tbody>
        <tr style="background-color: #f2f2f2;">
            <td style="border: 2px solid #4CAF50; padding: 12px;">John</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">30</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">IT</td>
        </tr>
        <tr>
            <td style="border: 2px solid #4CAF50; padding: 12px;">Alice</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">28</td>
            <td style="border: 2px solid #4CAF50; padding: 12px;">Marketing</td>
        </tr>
    </tbody>
</table>
  • <table> = Defines the start of the HTML table.
    style= Sets the table styles, including collapsing borders, full width, a green border, and a margin of 20px.
  • <thread>= Represents the table header section.
    <tr style= Styles the header row with a green background and white text.
    Name= Defines a header cell with a green border, padding of 12px, and the text “Name”. Similar cells for “Age” and “Department.”
  • <tbody>= Represents the table body section.
  • <tr style= Styles the first data row with a light gray background.
  • <td style= Defines a data cell with a green border, padding of 12px, and the text “John.” Similar cells for “30” and “IT.”
  • A similar structure for the second data row with alternating background color.

3. Then add the ‘Send an email(V2)’ flow action to send an email consisting of the HTML table with borders. Set all the details.

  • To: Provide the user email to whom you want to send email.
  • Subject: Enter the purpose of that email.
  • Body: I have given the Outputs of the Compose flow action here.
How to Create HTML Table with Border in Power Automate

4. Now, it’s time to Save and Test. Then, test it Manually. Then, the Send an email(V2) flow action will display the output below.

Create HTML Table with Border in Power Automate

This is how we can create an HTML table with Border in Power Automate.

Power Automate Create HTML Table From SharePoint List

Let’s see how to Power Automate create HTML table from a SharePoint list.

I have taken a SharePoint list named ‘Employees Data‘ with different columns and data types for this.

Columns Data Types
Employee IDSingle line of text
Employee NameSingle line of text
Employee Email IDMultiple lines of text
Employee DOBDate and Time
Power Automate create HTML table from SharePoint list

To work around this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page -> Click on + Create -> Select the Automated cloud flow -> Provide the flow name and choose the trigger’s flow (When an item is created and modified).

  • Provide the Site Address and List Name for this trigger.
Create HTML table in Power Automate from SharePoint

2. Add the ‘Get items’ flow action to retrieve all information from a SharePoint list and set the required fields.

  • In this action, provide the Site Address and List Name.
How to create HTML table in Power Automate from SharePoint

3. Next, add the ‘Create HTML table’ flow action for formatting and presenting data in a structured manner and set the required fields.

  • From: Here, I have selected the value of the Get items’ output from dynamic content.
  • Then, add the custom table value manually, as shown below.
HeaderValue
Employee Name
Employee Email ID
Employee DOB
Select value from the dynamic content under Get items and expression
How Power Automate create HTML table from SharePoint

4. Now, it’s time to Save and Test. Test it Manually -> Then the Create HTML table will display the output according to the custom value entered.

Power Automate create HTML table using SharePoint list

This is how Power Automate create HTML table from the SharePoint list.

Power Automate HTML Table Formatting

When we create a Power Automate HTML table without applying any formatting, it will appear unstyled, as shown below.

Power Automate create HTML table custom column

After formatting the Power Automate HTML table, it will appear as shown below.

Power Automate create html table formatting

How to Format HTML Table in Power Automate

To format an HTML table in Power Automate, follow the steps below.

Example:

I have used a SharePoint List named ‘Internal Job Post‘ with a few columns and their data types.

ColumnsData Types
Job Title Single line of text
Job DescriptionMultiple lines of text
SkillsChoice
Job Post DateDate and Time

Refer to the image below:

Power Automate format HTML table

To work around this, follow the steps below.

1. Open Power Automate using https://make.powerautomate.com in your browser. Click on + Create. Select the Instant cloud flow. Provide the flow name and choose the trigger’s flow (manually trigger the flow).

2. Add the ‘Get item‘ flow action to retrieve all the information of a SharePoint List and set the required field:

  • Site Address: Select and provide the specific SharePoint Site address.
  • List Name: Select the particular SharePoint list name.
Format HTML Table in Power Automate

3. To shape or transform the data received from a previous action in the flow, add the ‘Select’ flow action and set all the details:

  • From: Select the value from dynamic content [SharePoint list].
  • Map: Provide the column names and select their values from Dynamic content.
How to format HTML table in Power Automate

4. Next, add the ‘Create HTML table’ flow action for formatting and presenting data in a structured manner and set the required fields as:

  • From: Here, I have given the Output of the Select action from Dynamic content.
  • Columns: Select the type of columns to display the HTML table.
Power Automate format HTML table styling

5. Then, add the ‘Compose‘ flow action to format the table by using an expression and set the required field:

Inputs: Insert the expression to format the HTML table. At the end of the expression, set the output of the Create HTML table flow action from Dynamic content.

<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 #f2f2f2;
}
table thead th:first-child {
  border-left: none;
}
Format Power Automate HTML Table

6. Add the ‘Send an email(V2)’ flow action to display the formatted HTML table and set the required field.

  • To: Provide the user email address.
  • Subject: Enter the purpose of the email.
  • Body: Here, I have selected the Outputs of the compose action from dynamic content to construct the email’s body.
How to Format HTML Table in Power Automate

7. Now, it’s time to Save and Test. Then, test it Manually. Then, the Send an email(V2) flow action will display the output below.

Formatting HTML table in Power Automate

This is how we can format an HTML table in Power Automate.

Conclusion

I hope you find this Power Automate tutorial helpful. Here, I have explained how to create HTML table in Power Automate from an Array. I have also shown how to create an HTML table in Power Automate using a SharePoint list, including various table formatting.

You may also like: