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:
Your flow will look like this:
Next initialize another variable, call it Index, type = Integer and a value of 0, like below:
Next add an Apply to each, for the Select an Output from Previous Steps, select the ArrayVariable:
Inside the Apply to Each step, add an Increment variable, and choose Index, and increment it by 1:
Next add a compose:
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:
This will then create the items in the SharePoint list you have selected:
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:
And hey presto, all of the items have been added:
Here is the full flow end to end: