How to Convert CSV to Array in Power Automate?

Did you know how to convert CSV to Array in Power Automate? No, then don’t worry! In this Power Automate tutorial, I will demonstrate how to import CSV to Array using Power Automate.

CSV in Power Automate usually refers to Comma-Separated Values, a plain text format representing a tabular column. CSV files are often used for importing and exporting data between different applications or systems.

How to Convert CSV to Array in Power Automate

Here, I will explain how to import CSV to Array using Power Automate.

The Excel spreadsheet shown in the screenshot will be converted to a .csv file and then imported into an array using Power Automate, as shown below.

How to import CSV file to Excel using Power Automate

Let’s see how to import CSV to Array using Power Automate step by step:

1. For this, I have created an Excel spreadsheet with a few columns such as Candidate Name, Candidate Age, Candidate City, and Candidate Registration Date.

How Power Automate import CSV to Array

2. Save the file with a .csv extension on the local device.

How to convert CSV to Array using Power Automate

3. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page; click on + Create -> Select the Instant cloud flow -> Provide the flow name and choose the trigger’s flow(Manually trigger the flow).

I have added an input ‘File Content’ in this trigger as shown below.

How Power Automate convert csv to Array

4. To decode the data encoded in Base64 format, add the ‘Compose’ flow action (renamed as csvData) and provide expression.

base64ToString(triggerBody()['file']['contentBytes'])

Where this expression is used to convert a Base64-encoded string into an equivalent plain text (string).

Convert CSV file to Array in Power Automate

5. Then add the ‘Compose’ flow action, hit enter into inputs, and go to the next step.

How to convert CSV file to Array in Power Automate

6. Next, add the ‘Compose’ flow action (renamed as Array) and provide the required expression as shown below.

split(outputs('csvData'),outputs('Compose'))

It is used to split a string into an array of substrings based on a specified delimiter.

Power Automate convert CSV file to Array

7. Now, click Save and Test -> Test it Manually-> Inside Run flow tab, import the CSV file from your local device -> Click on Run flow.

How to convert CSV file to Array using Power Automate

8. The ‘Compose’ flow action will display the output according to the expression inserted in the Array(Compose) flow action as shown below.

How Import CSV to Array using Power Automate

This is how to import CSV to Array using Power Automate.

Conclusion

I hope you find this Power Automate tutorial helpful. Here, I have discussed how to import CSV to Array using Power Automate.

Moreover, you may like some more Power Automate tutorials: