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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating a CSV from an...
Power Automate
Answered

Creating a CSV from an array inside of an array

(1) ShareShare
ReportReport
Posted on by

I am using the Namely API to request the results of a report into a Microsft Flow. I then need to take the results of this and convert into a CSV table. The problem I am running into is the data is an array inside of another array. The JSON schema that is generate is as follows:

{
 "type": "object",
 "properties": {
 "reports": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "id": {
 "type": "string"
 },
 "type": {
 "type": "string"
 },
 "columns": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "name": {
 "type": "string"
 },
 "type": {
 "type": "string"
 },
 "label": {
 "type": "string"
 }
 }
 }
 },
 "content": {
 "type": "array",
 "items": {
 "type": "array"
 }
 }
 }
 }
 }
 }
}
The part that I am interested in is in red.
Basically, this an array of "reports" (which will always be only one array) which contains an array of "columns" (the column headers) and the array of "content" (which is the data I need). Some sample data is below. Does anybody know how I can use flow to create a CSV using this information? 
{
 "reports": [
 {
 "id": "53a4340a-b025-4d32-bd8f-2aa435b268b7",
 "type": "profile",
 "columns": [
 {
 "name": "profiles_guid",
 "type": "text",
 "label": "GUID"
 },
 {
 "name": "profiles_first_name",
 "type": "text",
 "label": "First name"
 },
 {
 "name": "profiles_last_name",
 "type": "text",
 "label": "Last name"
 },
 {
 "name": "profiles_email",
 "type": "text",
 "label": "Company email"
 },
 {
 "name": "profiles_start_date",
 "type": "date",
 "label": "Start date"
 },
 {
 "name": "profiles_employee_type",
 "type": "text",
 "label": "Employee type"
 },
 {
 "name": "profiles_category_6696",
 "type": "text",
 "label": "Department"
 }
 ],
 "content": [
 [
 "739675e7-2041-46a7-8965-691a5dac37cc",
 "Alice",
 "James",
 "AJames@none.com",
 "09/03/2019",
 "Full Time",
 "IT"
 ],
 [
 "8dba6571-abba-4fbc-b0b6-9858af6858e2",
 "Paul",
 "Jones",
 "PJones@none.com",
 "08/01/2019",
 "Part Time",
 "Human Resources"
 ]
 ],
 "links": {}
 }
 ],
 "meta": {},
 "links": {},
 "linked": {}
}
Thanks in advance,
 
Paul
Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    HI @PaulT 

     

    Please see the screenshots below:

     

     

    MicrosoftTeams-image (165).png

     

    MicrosoftTeams-image (166).png

    I have passed the JSON as an object in the intialise variable action and used the compose actions for the result. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • PaulT Profile Picture
    on at

    Thanks @yashag2255  but that only seems to get me the column headers. What I am trying to get to is the Content section. What I would like to end up with is a CSV with the following data:

     

    "739675e7-2041-46a7-8965-691a5dac37cc","Alice","James","AJames@none.com","09/03/2019","Full Time","IT"
    "8dba6571-abba-4fbc-b0b6-9858af6858e2","Paul","Jones","PJones@none.com","08/01/2019","Part Time","Human Resources"

     

    I am stuggling with taking an array of objects and getting them to be the rows of a CSV

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @PaulT 

     

    You can update your flow as:MicrosoftTeams-image (176).png
    Expression used on Append to Array Variable:
     
    {"Key1":"items('Apply_to_each_2')[0]","Key2":"items('Apply_to_each_2')[1]","Key2":"items('Apply_to_each_2')[3]","Key3":"items('Apply_to_each_2')[4]","Key4":"items('Apply_to_each_2')[5]","Key5":"items('Apply_to_each_2')[6]","Key6":"items('Apply_to_each_2')[7]"}

     

    Hope This Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard