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 / Create CSV table from ...
Power Automate
Suggested Answer

Create CSV table from array

(1) ShareShare
ReportReport
Posted on by 63
Hi,
 
I have an array of data.
 
I want to create a CSV table from this, taking values from each object/array within the array and then save the completed CSV to a SharePoint site. 
 
To do this, I am starting with the following... is this correct? How can I, when the CSV is populated, save it to a SP site? If I go outside of the loop, how do I get the CSV data so that I can use the Create File (SharePoint) action?   If I put the action inside the loop, it'll create hundreds of files :( :(
 
 
Thank you
SD
Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi,
     
    You will need to make some small changes in your process. First, make sure that you are working with an array of objects (like in the Compose from the image below), as this is a requirement for  generating a CSV from this array. You can check these blog posts for more reference on the different Data Types in Power Automate and the Object Data Type in Power Automate
     
    As you want to generate a csv from an array, you won't need to loop it inside an Apply to each, but just pass the whole array as input to the Create CSV table action, like in the example below:
     
     
     
    By just doing that, you already have your CSV data, and now you just need to store it in a file. For that, you can use a Create file action, select the path where you want to save it, and pass the outputs from Create CSV table as "File content" (see the arrow below). For the "File name", make sure to include the extension .csv (highlighted in yellow):
     
     
    After running the flow, the CSV file is created in SharePoint:
     
    And it contains the same data from your array:
     
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
     
  • Suggested answer
    David_MA Profile Picture
    12,978 Super User 2025 Season 2 on at
    I believe you want to pick certain values from each row in your array rather than create a csv file from the entire array, which is why you use the apply to each. If so, initialize a sting variable in your flow and set the default value to the comma-separated values you want for the header row. For example:
    The expression at the end adds a line break, which is important so that all the values are not on the same row. The expression to add the line break is:
    decodeUriComponent('%0A')
    Then in the apply to each, add a Append to string variable and populate it with the values you want. For example:
     
    Again, be sure to add the expression for a line break at the end. Then to create the file you would do the same as @rzaneti posted except you would replace Output with the string variable.
  • Suggested answer
    David_MA Profile Picture
    12,978 Super User 2025 Season 2 on at
    There is an easier way to do what you want instead of what I posted below, but either method should work for your use case. You can also use a Select action followed by a Create CSV table action:
    I used the append to string variable method below because that solution is making a call to the graph API and can only return 999 rows at a time. If I tried the above method with that, I would end up with multiple CSV files.
     

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard