In this Power Automate tutorial, I will explain how to create an array from SharePoint list items using Power Automate. We will see how to get items from the SharePoint list and then create and display the values in an array format using Power Automate or Microsoft Flow.
Create an Array from SharePoint list items using Power Automate
The flow will be triggered manually, and we use the get items action to get all the list items from the SharePoint list. Then we will create an array from the Get items dynamic content value.
Here we will use the below Product list:
- Product ID – default title column
- Product Name – Single line of text
- Product Color – Choice type
- Quantity – Number type
- Total Price– Number type
- OrderedDate – Date type
Follow the below steps, to build a flow to Create an Array from the SharePoint list item.
Let us see how to create an array from SharePoint list items using Power Automate.
Step:1
Create an instant cloud flow, enter the flow name and select the manually trigger a flow action and click create button.
Step:2
Add an Initialize variable action of type array, that we will use later in our flow.
Step:3
Select the Get items action to get all the values from the SharePoint List and Configure the SharePoint site address and list name.
Step:4
Select Apply to each action and pass the dynamic content values as an output from the previous steps:
Now select an Append to array variable action and choose the initialized variable. In the value section pass the dynamic content values or the below expression.
{
"ProductID":@{items('Apply_to_each')?['Title']},
"ProductName":@{items('Apply_to_each')?['ProductName']},
"ProductColor":@{items('Apply_to_each')?['ProductColor/Value']},
"Quantity":@{items('Apply_to_each')?['Quantity']},
"TotalPrice":@{items('Apply_to_each')?['TotalPrice']},
"OrderedDate":@{items('Apply_to_each')?['OrderedDate']}
}
Step:5
Add a compose action, and pass the dynamic content value of an initialized variable array.
Step:7
Save and Test the flow by selecting the Run flow option. Once the flow ran successfully, like below:
We can see in the Output section it displays the SharePoint list item values in an array format.
This is how to create an array from SharePoint list items using Power Automate or Microsoft Flow.
Power Automate: Create an array from SharePoint list items
Here is another example of creating an array from SharePoint list items.
Initially, we will get items from a SharePoint list and create and display the values in an array format using Power Automate.
We are going to use a SharePoint Online list having the following columns:
- TaskName – default Title column
- Assigned To – Person or Group type
- TaskPrioirity – Choice Type
- Status – Choice Type
- StartDate, Due Date, and TaskcompletedDate – Date Type
And the list with some data looks like below:
Let us see how to create an array from get items using Power Automate flow.
Step:1
Create an instant cloud flow, enter the flow name, select the “manually trigger a flow action“, and click the create button.
Step:2
Select the +New step and add an Initialize variable action of the type array that we will use later in our flow.
Step:3
Select the +New step and, add the Get items action from the action triggers, configure the SharePoint site address and list name.
Step:4
Select the +New step, add an apply to each action from action triggers, and pass the dynamic content value of Values to loop through all the items presented in the SharePoint list.
- Now select Append to array variable action select the initialized array variable(TaskDetails) from the dropdown, and pass the values in the Values section.
- Here we will pass JSON values to get the TaskName, AssignedTo, TaskStatus, and TaskCompletedDate.
{
"name": "TaskDetails",
"value": {
"TaskName": "@items('Apply_to_each')?['Title']",
"AssignedTo": "@items('Apply_to_each')?['AssignedTo/DisplayName']",
"TaskStatus": "@items('Apply_to_each')?['Status/Value']",
"TaskCompletedDate": "@items('Apply_to_each')?['TaskCompletedDate']"
}
}
Add a compose action and pass the dynamic content variable value to see the output of the selected values in an array format.
Step:5
Save the flow. Run the flow by selecting the Run flow option. Once the flow ran successfully like below.
we can see the expected result value of TaskName, AssignedTo, TaskStatus, and TaskCompletedDate for all three items presented in the SharePoint list, in the Output of the compose action in an array format.
This is how to create an array from get items using Power Automate flow.
Conclusion
In this Power Automate tutorial, we have learned how to get list items from a SharePoint list and then how to create an array from those SharePoint list items using Power Automate or Microsoft Flow.
You may also like:
- How to remove an item from an array in Power Automate?
- Parse JSON Object to Array in Power Automate
- Power Automate Filter Array
- Power automate split string into an array
- How to Create CSV table using Power Automate
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.