top of page
Writer's pictureJon Russell

Create a list items using an array in Power Automate

Morning all,


I came across this post on the Power Automate forums:


"Title: Create a list items using an array in Power Automate


Hello Power Users,

 

I have a sample array in the below format and would like to loop. through it to create list items inside a SharePoint list.

 

Array :  ["AAA, BBB, CCC",

              "DDD,EEE,FFF",

               "GGG,HHH,III"]

Can anyone please help!

 

Thank you so much in advance!"


Ok, lets take a look.


First of all, create a new flow, call it whatever you want, I have gone with the post title. I have created, and instant flow, as I think that is easiest here.


The next step is to create an Array variable:


Step 1 Initialize ArrayVariable

Your flow will look like this:


Flow progress so far


Next initialize another variable, call it Index, type = Integer and a value of 0, like below:

Step 2 Initialize Index variable

Next add an Apply to each, for the Select an Output from Previous Steps, select the ArrayVariable:


Step 3 - Apply to each

Inside the Apply to Each step, add an Increment variable, and choose Index, and increment it by 1:



Step 4 - Increment Index variable

Next add a compose:


Step 5 - Compose current item

The inputs will be the Current item, you ca write this as an expression if you want as item()


Finally, add your outputs of the compse (within the apply to each) to your SharePoint site:


Step 6 - Create item in SharePoint

This will then create the items in the SharePoint list you have selected:


Result in SharePoint

The beauty of this method is that you can have as many items in your array at the start for example:


I have added more lines to the ther ArrayVariable:



Adding additional lines to the Array

And hey presto, all of the items have been added:


Result in SharePoint after more array items have been added

Here is the full flow end to end:


Power Automate cloud flow structure end to end, all steps

2,658 views1 comment

Subscribe Form

©2019 by Jon Does Flow. Proudly created with Wix.com

bottom of page