Create CSV or Excel files from Power Automate
If you work with Power Automate, you will occasionally need to create CSV or Excel files. In this article, I will show the following:
Let's explore both options.
Option # 1: Create CSV File: the easiest option by far.
Few notes:
STEPS:
4. In this case, to create a CSV table, you have to ensure that you are not just simply selecting the body of the action prior, but that it has to have this syntax
body('Parse_JSON')?['ResultSets']?['Table1']
5. The last step is to save the file. You can either email it or upload it to OneDrive or Sharepoint. Here is a quick code on how to save it to OneDrive in a new folder:
JobID - > is a parameter passed at the beggining of the flow
File Content - > body ("Create_CSV_table")
Final Flow
领英推荐
Option # 2: Create an Excel file: this requires a little bit more work
Few notes:
STEPS:
2. I am passing the data by running the SQL stored procedure.
3. After running the store procedure, create a new Excel file: the File Content is coming from the action above: body('Get_File_Content')
4. Parse JSON the same way as for CSV files
5. Optional step: Use Compose step to write back to the file:
6. We have a dynamically created Excel file, so the name will also have to be passed dynamically as the following ( in this case):
concat('/',triggerBody()['number'],'/',outputs('Create_file_2')?['body/Name'])
7. Row will be the output from the Compose Step above.
Done.
Project Manager
7 个月Great Job Larisa!!????