How to Create a CSV Table in Power Automate? [With Examples]

Recently, I encountered a scenario where I needed to automate the generation of a CSV file from SharePoint data using Power Automate. This requirement came up during a client project where we needed to export data in a structured, easy-to-share format. Generating a CSV table using Power Automate proved to be an efficient way to meet this need.

In this tutorial, I will explain how to create a CSV table in Power Automate. Additionally, I will cover:

  • Create a CSV table with custom columns in Power Automate
  • Create a CSV table from JSON data using Power Automate
  • How to use the Create CSV Table action in Power Automate
  • Create a CSV table from an array in Power Automate
  • Create a CSV table from a SharePoint list using Power Automate

Create CSV Table Action in Power Automate

The Create CSV Table action in Power Automate converts a list of data into a CSV (Comma-Separated Values) format, making it easy to share or store information. It takes input data, like a list from SharePoint or an Excel file, and transforms it into a table format where each row corresponds to a record and each column corresponds to a field.

The output is a CSV file containing data neatly arranged with values separated by commas. This CSV file can be used in various ways, such as sending it as an email attachment or saving it to a cloud storage location.

The Power Automate Create CSV Table action accepts Two parameters.

  • From: It can be a collection, array, or data from sources like SharePoint, Excel, or other connectors that return multiple items.
  • Columns: This defines the columns in the CSV table. You can choose:
    • Automatic: All columns from the input data in the CSV.
    • Custom: You can manually define which columns you want to include and their respective names.
create csv table power automate

Create a CSV Table From Array in Power Automate

Suppose you have an array of data, such as a list of employees with their names and emails, and you want to convert this array into a CSV table using Power Automate.

Follow the below steps:

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate create csv table

2. Add an Initialize variable action where we provide our array using the below parameters:

  • Name: Provide the name of the variable. In my case, I give EmployeeArray
  • Type: Set the variable type as an array from the dropdown
  • Value: Provide your array, or you can provide the below array:
[
  {
    "Name": "John Doe",
    "Email": "[email protected]"
  },
  {
    "Name": "Jane Smith",
    "Email": "[email protected]"
  },
  {
    "Name": "Robert Johnson",
    "Email": "[email protected]"
  },
  {
    "Name": "Emily Brown",
    "Email": "[email protected]"
  },
  {
    "Name": "Michael Davis",
    "Email": "[email protected]"
  }
]
create csv table in power automate

3. Now select the Create CSV table action. Then, give the variable from dynamic content in the From field and set the Columns as Automatic.

power automate create csv table from array

Now, click Save and run the flow manually. After it runs successfully, click the create CSV table action. Then, in the output section, you can see the csv table.

Create a CSV Table From Array in Power Automate

You can create a CSV table from an array using Power Automate.

Create a CSV Table From the SharePoint List using Power Automate

I want to export all tasks from a SharePoint list named Project Tasks into a CSV file and then email the generated CSV file to the project manager.

power automate create csv file

Now follow the below steps:

1. In the Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

power automate create csv table

2. Then add a Get items action to retrieve all items present in the SharePoint list and provide the following parameters:

  • Site Address: Select the SharePoint site address.
  • List Name: Select the name of the SharePoint list from the drop-down.
create csv power automate

3. Now select the Create CSV table action, enter the variable from dynamic content in the From field, and set the Columns to Automatic.

create csv table from array power automate

4. Now, add a Send an email action to send the CSV file. To do this, add the Send an email action with the following parameters:

  • To: Enter the recipient’s email address (e.g., the manager’s email).
  • Subject: Provide a subject for the email.
  • Body: Write the body content of the email, including any message or instructions.
  • Attachments: For the Attachment Name, enter Project Tasks.csv. For the attachment content, select Output from the Create CSV table action.
Create a CSV Table From the SharePoint List using Power Automate

Now, click Save and run the flow manually. After it runs successfully, you can see an email received by your project manager.

create csv file power automate

When you open the csv file, you can see some default column shows.

csv table power automate

In the next example, I will show how to fix this one.

Create CSV Table Custom Columns in Power Automate

To do this, I will edit the existing flow and select the Create CSV table action. In the Columns field, change the setting from Automatic to Custom. Next, map the custom headers to the corresponding values from the SharePoint list

HeaderValue
Taskitem()?[‘Task’]
Assigned Toitem()?[‘AssignedTo/DisplayName’]
Due Dateitem()?[‘DueDate’]
Priorityitem()?[‘Priority/Value’]
Create CSV Table Custom Columns in Power Automate

Now, click Save and run the flow manually. Once it runs successfully, your project manager will receive your email. After that, open the CSV file.

Power Automate create CSV table custom columns

Create CSV Table From JSON using Power Automate

suppose a finance department needs to report the current exchange rates of various currencies against the US Dollar (USD) to understand international transactions better. They receive this data in JSON format from a financial API every day.

Our work involves converting the JSON data of currency exchange rates into a CSV file and emailing it using Power Automate.

I want the Power Automate flow to trigger at a specific time, so I used a scheduled cloud flow in Power Automate. Let’s see how to create it:

1. Navigate to the Power Automate Home page, click + Create, and select the Scheduled Cloud Flow. Then provide the following information:

  • Starting: Provide on which date you want to run your flow.
  • at: Provide the time you want to run the flow, in my case, at 8:00 AM.
  • Repeat every: We want to run the flow every weekday, so here, select 1 week.
  • On these days: Select the Weekdays, i.e., Monday to Friday.
powerautomate create csv table

2. Add an Initialize variable action where we provide our array using the below parameters:

  • Name: Provide the name of the variable. In my case, I give JsonData
  • Type: Set the variable type as a string from the dropdown
  • Value: Provide your array, or you can provide the below array:
{
  "base": "USD",
  "date": "2023-10-21",
  "rates": {
    "JPY": 150.25,
    "GBP": 0.74,
    "AUD": 1.40,
  }
}
create csv file in power automate

3. Add the Parse JSON action. Then in the Content field select the JsonData variable from dynamic content. Then you can generate the schema like below:

{
    "type": "object",
    "properties": {
        "base": {
            "type": "string"
        },
        "date": {
            "type": "string"
        },
        "rates": {
            "type": "object",
            "properties": {
                "JPY": {
                    "type": "number"
                },
                "GBP": {
                    "type": "number"
                },
                "AUD": {
                    "type": "number"
                }
            }
        }
    }
}
power automate create csv from array

4. Add again Initialize variable action, then provide the variable name as csv, and type as a string in the value section provided below:

Base,Date,Country Currency Name,Currency Rate
power automate create csv from json

5. Select Append to string variable. Then, provide the variable name, and in the Value field, enter the value below.

power automate create csv table from json

6. Now, we will append a row to the CSV table for Great Britain Pound. Select Append to string variable and provide the variable name as CSV data. Then, enter the value.

power automate create csv table from csv file

7. Now, we will append a row to the CSV table for Australian Dollars. Select Append to string variable and provide the variable name as CSV data. Then, enter the value.

power automate create csv file and email

8. Now, add a Send an email action to send the CSV file. To do this, add the Send an email action with the following parameters:

  • To: Enter the recipient’s email address.
  • Subject: Provide a subject for the email.
  • Body: Write the body content of the email, including any message or instructions.
  • Attachments: For the Attachment Name, enter Currency Rates.csv. For the attachment content, select Output from the Create CSV table action.
csv power automate

Now, click Save and run the flow manually. Once it runs successfully, your recipient will receive your email. After that, open the CSV file.

Create CSV Table From JSON using Power Automate

In this tutorial, I covered how to use the Create CSV Table action in Power Automate, including generating a CSV table from an array and exporting data from a SharePoint list to a CSV file.

Additionally, I explained how to customize CSV columns, convert JSON data into a CSV file, and send the generated CSV file via email using Power Automate.

Related Power Automate articles:

  • Hi, I’m new to Power Automate and I have a project to create a CSV table from an excel file. I was able to do it, but my issue is that I’d like one of the header title to actually get populated in each row of column. For example; I have 3 column: ID, Code, Amount. I have IDs of the employee ID in the first column, second column I would like pay code Expenses in each row, third column will be the amount. Currently, Expenses sits as header and amounts are in the Expense column. Please help. Thanks.

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…