web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How can I make a dynam...
Power Automate
Answered

How can I make a dynamic array of arrays?

(1) ShareShare
ReportReport
Posted on by 6
I want to use graph api to write multiple rows to excel at once.
Write data to an Excel workbook - Microsoft Graph | Microsoft Learn
the post looks like this where it expects an array of arrays.
{
  "index": null,
  "values": [
    ["alex darrow", "adarrow@contoso.com"],
    ["mr man", "mrman@contoso.com"],
  ]
}
 
I did a list rows to get my data, then a select on it and a parse json. which gets me a really nice json that has every row that I need.
When I loop through that parse json output and try to append an array (row) to my array it doesn't let me.

BadRequest. The input value is of type 'Array' which cannot be appended to the variable 'tableData' of type 'Array'. The action type 'AppendToArrayVariable' only supports values of types 'Float, Integer, String, Boolean, Object'.
 
Is there a way that I can do this?

but I can initialize an array with something like this
[
  [
    "Apple",
    "Banana",
    "Cherry"
  ],
  [
    "Dog",
    "Cat",
    "Bird"
  ],
  [
    "Red",
    "Blue",
    "Green"
  ]
]

All I want to do is extend this ^
Categories:
I have the same question (0)
  • Verified answer
    WillPage Profile Picture
    2,307 Super User 2025 Season 2 on at
    You've struck one of the major annoyances in Power Automate for anyone trying to deal with 3-dimensional data.

    Power Automate can handle nested arrays just fine, but it's like the developers of the Append to array variable action just forgot about that. But thankfully there are workarounds.
     
    You can use a Select to construct your array. This may or may not be feasible depending on your specific use-case but you can certainly add an array on the right side of a key-value pair in Select and you can also add an array using addProperty() when in JSON mode.
     
    Another is you can put your inner array in a Compose within your Apply to each loop and then after the loop, add another Compose and set its formula to outputs('Inner_Compose') where Inner Compose is the name of the Compose that's inside your loop, containing an array of data. The output of the outer compose will be an array of arrays.
     
    For example, original data:
    Inner Compose:
    Outer Compose:
     
    Result:
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    Using a Select to append to an array:
     

    Select From:
    Create a range from 0 to the length of the initial array + 1
    range(
    	0,
    	add(
    		length(variables('test')),
    		1
    	)
    )
    Select Map:
    If item() is within the array length, take the corresponding array element.
    Otherwise, take the value to be added.
    if(
    	less(
    		item(),
    		length(variables('test'))
    	),
    	variables('test')[item()],
    	outputs('Compose')
    )
     
    The new variable "test":
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    If the array elements are all different and the order doesn't matter to you, you can also use the union() function.
    Replace the Select below with a Compose and the following expression.
     
    union(variables('test'), createArray(outputs('Compose')))
     
  • CU14082141-0 Profile Picture
    6 on at
    Thank you everyone for the help I got it working. I used the select. I didn't know that there is a little text button at the top right that changes it from key value pair that was outputting an array of objects to a single text field that just maps my data to an array of arrays. voilà, I simply put that output into the values for the post and graph api accepted it. Now I'm writing to excel super fast. Makes me wonder what the benefit of using list a row into a table is.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 507 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 267 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard