Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Make a combined array out of 2 or more arrays with the same rows from all.

(0) ShareShare
ReportReport
Posted on by 256

I have found methods that use an 'apply to each', but this relies on inputting the arrays. I have these arrays built and i would like to combine them. The number of arrays within the variable can change. Does anyone know of a template flow that I can call to combine x amount of arrays? Or, better yet, is there a quick way to merge arrays where we are joining each row?

jaeiow_0-1656601583047.png

 

[
 "[{\"Filename\":\"Excel VBA folder files.xlsx\"},{\"Filename\":\"Data.xlsx\"},{\"Filename\":\"ALAN.xlsx\"}]",
 "[{\"Title\":\"Excel VBA folder files\"},{\"Title\":\"Data\"},{\"Title\":\"ALAN\"}]",
 "[{\"folder\":\"Export files from local folders\"},{\"folder\":\"Export files from local folders\"},{\"folder\":\"Export files from local folders\"}]"
]

Sample Arrays 

  • jaredbidlow Profile Picture
    256 on at
    Re: Make a combined array out of 2 or more arrays with the same rows from all.

    Let me back up to array of array creation. In order to get the array of arrays, all I did was do

    concat(',',body('Select_2')) in an "append to string var" inside a loop. So i don't think that this is a true array that can be used in an apply to each. But I could be wrong, Is there another way to build the array or should it work with the current format.

     

    "ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@variables('string')' is of type 'String'. The result must be a valid array."
  • takolota1 Profile Picture
    4,890 Super User 2025 Season 1 on at
    Re: Make a combined array out of 2 or more arrays with the same rows from all.

    If you’re just trying to append a variable number of arrays, you should be able to use an Apply to each on the array of arrays and in each loop set a variable action to append the next array with a union( ) of its previous variable value & the loop item.

  • jaredbidlow Profile Picture
    256 on at
    Re: Make a combined array out of 2 or more arrays with the same rows from all.

    I want to it by index (not present, but self explanatory 1, 2, 3....). This merging of arrays of equal length into one array will collect all the keys/value from the indices into a {}. The number of times it does this will be variable, but I have only found solutions based on 2 or 3 arrays, not variable. I think a nested "Do Until" could do the trick, but this would take very long even if it did.

  • takolota1 Profile Picture
    4,890 Super User 2025 Season 1 on at
    Re: Make a combined array out of 2 or more arrays with the same rows from all.

    @jaeiow 

     

    Do you mean append arrays, so add one array’s items below another’s or do you mean merge a key/column from one array into another array based on a primary key?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492