Create an Array from SharePoint list Items using Power Automate

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
Power Automate Create Array from SharePoint list

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.

Create an Array from a SharePoint list using Power Automate

Step:2

Add an Initialize variable action of type array, that we will use later in our flow.

Create Array from SharePoint list using Microsoft 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.

Create Array from SharePoint list item using Microsoft flow

Step:4

See also  How to find product number of hp laptop using command prompt

Select Apply to each action and pass the dynamic content values as an output from the previous steps:

Create an Array from a SharePoint list using Power Automate example

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']}
}
Example to Create an Array from SharePoint list using Power Automate

Step:5

Add a compose action, and pass the dynamic content value of an initialized variable array.

Example to Create an Array from SharePoint list using the Power Automate

Step:7

Save and Test the flow by selecting the Run flow option. Once the flow ran successfully, like below:

Create an Array from the SharePoint list using power Automate

We can see in the Output section it displays the SharePoint list item values in an array format.

Create an Array from the SharePoint list using power Automate flow

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:

create an array from get items using Power Automate

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.

How to create an array from get items using Power Automate

Step:2

Select the +New step and add an Initialize variable action of the type array that we will use later in our flow.

create an array from get items using Power Automate flow

Step:3

See also  Remove Duplicate items from SharePoint List using Power Automate

Select the +New step and, add the Get items action from the action triggers, configure the SharePoint site address and list name.

create an array from get items using the Power Automate

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.

How to create an array from get items using Power Automate flow
  • 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']"
        }
    }
Example to create an array from get items using Power Automate

Add a compose action and pass the dynamic content variable value to see the output of the selected values in an array format.

Example to create an array from get items using Power Automate flow

Step:5

Save the flow. Run the flow by selecting the Run flow option. Once the flow ran successfully like below.

power automate create array from get items

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.

power automate create array from get items example

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:

>