Introduction
The use case here is when a CSV is uploaded to the SharePoint online document library, and the Power Automate reads the CSV and parses the data into the SharePoint list. I have written a similar use case, but in that, the CSV document is uploaded to One Drive. Please refer to the link in the references section for the CSV uploaded to One Drive.
Steps
Below are the steps briefly.

- The user uploaded the CSV to the SPO Document Library.
- Power Automate gets triggered based on the condition
- Data from CSV is parsed and created in the SharePoint list.
Step 1. Create and Configure SharePoint list and library. Here, I am using the sample below for this scenario.

For the SharePoint list, I have created the list with the required metadata. Title, City, State, Zip, CostCenter. All are of type ‘single line of text’.

For the document library, I have created a folder called ‘CSVs’ inside the default ‘Shared Documents’ Library.

The idea here is that when a file gets created inside the folder, the data from the CSV file needs to be parsed and created in the SharePoint list. Let’s see this in action.
Step 2. Login to https://flow.microsoft.com with your organization / Development tenant credentials. From the home page, click on ‘Create’ à select ‘Automated cloud flow’.

Step 3. Give a meaningful name. Here I have selected the trigger ‘When a file is created in a folder’.

Step 4. Add an action ‘Get file content’ and select the file identifier ‘x-ms-file-id’ under the ‘Dynamic Content’. Below is the screen capture for reference.

Step 5. The output from the ‘SharePoint Get File Content’ is in octet-stream, which is not in readable format. In order to query the data, it needs to be converted to string format. For this, I am using the function called ‘base64ToString()’.
base64ToString(outputs('Get_file_content')?['body']['$content'])

Step 6. Now select the ‘Compose’ action and rename it to ‘Compose –new line’. Inside the ‘Inputs’ field, just hit the ‘Enter’ key. This denotes a new line.

Step 7. Now select another compose. Rename it as ‘Compose – split by new line’. Here, we need to split the outputs of get file content by the new line. Let's see how to do this.
select expression and enter split([Select the outputs from file content], [select the output of compose-new line].

Step 8. Now, get the field names. We know from the CSV that the header has field names. In this case, the input CSV file has five fields.

The result in my case is,
split(first(outputs('Compose_-_split_by_new_line')),',')

Step 9. Now, add a new step and choose the ‘select’ action. Under expression, it should skip the first record since the first row contains the data.

Step 10. Configure the key and value as per the following.
- key: These should be values from the outputs ‘compose - get field names’. Note that we are getting the array values here.
- value: It should be the values from the outputs of compose-split by new line’.



















Join the conversation! Your thoughts help the community grow.