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

In this Power Automate tutorial, we will see how to create an HTML table from an Array in Power Automate with examples. In addition, we will also cover how to create an HTML Table from a filter array in Power Automate.

I will also show you, how to create an HTML table from multiple arrays in Power Automate.

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

Let us see how to create an HTML table from an array in Power Automate.

In this example, we are going to create an array of objects for the TaskName and Status. Later, we will generate an HTML table from an array value.

Follow the below steps, to achieve this:

  • Login into Power Automate and create an instant cloud flow to trigger manually.
  • Select Initialize variable action, then enter the variable name, choose the variable type as Array, and pass the array of objects like below.
[{  "TaskName": "SharePoint",
  "Status": "Completed"}, 
{ "TaskName": "PowerApps",
  "Status": "InProgress"},
{ "TaskName": "PowerAutomate",
  "Status": "InProgress"}]
Create an HTML Table from an Array
  • Now click on the next step, to map the key-value pair we will use 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. We use the item() function to pick the value from an array of objects. so pass the below expressions:
item()['TaskName']
item()['Status']
Create an HTML Table from an Array example

Now we will create an Html table, select Create Html table action, the provide the output of the Select action.

Example to Create an HTML Table from an Array

Save and test the flow manually, Once the flow ran successfully like below:

Create an HTML Table from an Array of objects

we can see the HTML table has been generated in the output section from an array of objects and displays the Task Name and Task Status.

Example to Create an HTML Table from an Array of objects

This is how to create an HTML table from an array using Power Automate.

How to Create an HTML Table from a filter array in Power Automate

Here we will see how to create an Html table from a Filter array using Power Automate.

In this example, we will use the below-displayed SharePoint list:

  • Task name – default title column
  • Assigned To – Person or group column
  • Task Priority and Task Status – Choice column
Create an HTML Table from a filter array using the power automate flow

Now we will create a flow to generate an HTML table for the filtered 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 to generate an HTML table based on array values. as below:
Create an HTML Table from a filter array example

Now we will filter the value based on the Status column, so click on the Next step and select the Filter array action. Then provide the field value

  • From- value from Lists
  • Value- choose the status column
  • Operator- is equal to
  • Value- completed
Example to Create an HTML Table from a filter array

Then choose Select data operation and map the values to create an HTML table. Then provide the body of the filter array in From and switch to text and add the below values.

{
  "TaskName": @{items('Apply_to_each')?['Title']},
  "AssignedTo": @{items('Apply_to_each')?['AssignedTo/DisplayName']},
  "TaskPriority": @{items('Apply_to_each')?['TaskPriority/Value']},
  "TaskStatus": @{items('Apply_to_each')?['Status/Value']}
}
Create an HTML Table from a filter array using flow

Select Create Html table action to generate a table, and provide the output of the Select action.

Create an HTML Table from a filter array using power automate flow

Save and test the flow manually, and we can see the table filters and displays the value from an array.

How to Create an HTML Table from a filter array

In the below screenshot, we can see it filters and displays the data where the status is completed.

Create an HTML Table from a filter array using power automate

This is how to create an Html table from a Filter array using Power Automate.

Create HTML table From Multiple Arrays in Power Automate

In this example, we will trigger a flow manually that will get values and store them in different arrays. Later, we will generate an HTML table from these arrays.

Follow the below steps, to achieve this:

Step:1

Create an instant cloud flow to trigger manually. Expand the trigger and add a text input for First Name, Last Name, and Role.

Power Automate Create HTML table From Multiple Arrays

Step:2

Select the New step and initialize a variable of integer data type and name it as an index and pass the value as 0.

Create HTML table From Multiple Arrays using Power Automate

Step:3

Also, initialize a variable of type array and name it as arrFinal and pass the Empty array [] in the values section.

Create HTML table From Multiple Arrays using Power Automate flow

Step:4

Now to store a First Name, Last Name and Role add an initialize variable action and Enter the name as Arr1, Arr2, Arr3 then choose the variable type as array. In the value section pass the dynamic content value of First Name, Last Name, and Role.

Create HTML table From Multiple Arrays using the Power Automate flow

Step:5

Then add a new step, select the apply to each action and select the arr1 dynamic value output of the previous action.

Example to Create HTML table From Multiple Arrays using Power Automate

Now select an Append to array variable action and choose the initialized variable called arr Final. In the value section pass the below expression.

{
"FirstName": @{item()},
"LastName": @{variables('Arr2')[variables('Index')]},
"Role": @{variables('Arr3')[variables('Index')]}
}

Where,

  • FirstName, LastName, Role = Column Names
Example to Create HTML table From Multiple Arrays using Power Automate flow

Select the next step and choose increment variable action and increment the index variable by 1 like below:

Example to Create HTML table From Multiple Arrays using flow

Step:6

Now select Create an HTML table action and pass the dynamic content value of initialized arr Final variable.

Example to Create HTML table From Multiple Arrays using Microsoft flow

Step:7

Save and Test the flow, Enter the first name, Last Name, and Role, and click on the Run flow option.

Example to Create HTML table From Multiple Arrays using the Power Automate

Once the flow ran successfully, we can see the HTML table has been generated in the Outputs of the create HTML action.

Create HTML table From Multiple Arrays using the Power Automate

This is how to create an HTML table from multiple arrays in power automate.

Conclusion

In this Power Automate tutorial, we saw how to create an HTML table from an Array in Power Automate with an example. In addition, we also covered how we can Create an HTML Table from a filter array in Power Automate. I also explained, how to create an HTML table from multiple arrays using flow.

You may like the following Power Automate tutorials:

>