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"}]
- 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']
Now we will create an Html table, select Create Html table action, the provide the output of the Select action.
Save and test the flow manually, Once the flow ran successfully like below:
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.
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
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:
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
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']}
}
Select Create Html table action to generate a table, and provide the output of the Select action.
Save and test the flow manually, and we can see the table filters and displays the value from an array.
In the below screenshot, we can see it filters and displays the data where the status is completed.
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.
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.
Step:3
Also, initialize a variable of type array and name it as arrFinal and pass the Empty array [] in the values section.
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.
Step:5
Then add a new step, select the apply to each action and select the arr1 dynamic value output of the previous action.
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
Select the next step and choose increment variable action and increment the index variable by 1 like below:
Step:6
Now select Create an HTML table action and pass the dynamic content value of initialized arr Final variable.
Step:7
Save and Test the flow, Enter the first name, Last Name, and Role, and click on the Run flow option.
Once the flow ran successfully, we can see the HTML table has been generated in the Outputs of the create HTML action.
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:
- How to merge pdf files in Power Automate?
- Create an HTML Table in Power Automate
- add Site columns to SharePoint content type using Power Automate
- Create an HTML Table from Excel in Power Automate
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com