How to Import Data from Excel to a SharePoint list using Power Automate?

In this Power Automate tutorial, I will show you how to import data from a csv file to a SharePoint list using Power Automate. The same steps you can follow to import data from Excel to a sharepoint list using power automate.

I have a CSV file i.e. ‘Username’, which is stored in the SharePoint document library. So, we will create an instant cloud flow that will get and parse the CSV data and then we will store it in a SharePoint list called Username using Power Automate.

Import CSV Data to a SharePoint List in Power Automate

The CSV file ‘Username’ contains the below columns:

  • Username
  • Identifier
  • First name
  • Last name
Import CSV Data to a SharePoint List in Power Automate

The SharePoint list ‘Username’ contains the below column:

  • Username (Title)- Single line of text
  • Identifier – Number
  • First name- Single line of text
  • Last name- Single line of text
Power automate csv to sharepoint Online list

Now, we will create a flow that will save data from CSV to SharePoint list using Power Automate.

Save CSV or Excel Data to a SharePoint List in Power Automate

Here we will see how to save CSV or Excel data to the SharePoint list using Power Automate.

Before we start creating flow in Power Automate, make sure you have the CSV file uploaded in the SharePoint document library. And you have created the above SharePoint list with the columns as it is.

Step 1: Log in to Power Automate, and click on +Create, select Instant Cloud flow.

power automate import data from excel to sharepoint list

Then provide the flow name, and select the Manually trigger a flow action. Then click on Create.

import data from excel to sharepoint list using power automate

Now, you can see Manually triggered flow is added to the flow page.

power automate csv to sharepoint list

Step 2: Next, we will get the the content of csv file, so, click on the +New step -> select Get file content using the path action. Then provide the below information:

  • Site address: Select or provide the SharePoint site address.
  • File path: Provide the file path.
import data from excel to sharepoint list using power automate

Step 3: Now we will convert the above content into a string, so, click on the +New step -> select Compose action. Then provide the below information.

  • Inputs: Provide the below expression:
string(outputs('Get_file_content_using_path')?['body'])
Microsoft power automate parse csv to sharepoint list

Step 4: Next click on the +New step -> select Compose action. Then provide the below information.

See also  Conditional Formatting In Power Bi Stacked Column Chart

Inputs: Here click on Enter to create a new line.

power automate import csv data to sharepoint list

Similarly, create 3 compose actions, and provide the below information in the Inputs field

  • Compose -split rows
split(outputs('Compose-csv_content'),outputs('Compose-new_line'))
  • Compose-split by new line
split(outputs('Compose-csv_content'),outputs('Compose-new_line'))
  • Compose -get fields name
split(first(outputs('Compose-split_by_new_line')),',')
import CSV data to a SharePoint list in Power Automate

Step 5: Next we will skip the first row of data, that can field heading, and we will use the heading in mapping. So, click on the +New step -> select ‘Select‘ action. Then provide the below information:

  • From: In this Provide the below expression:
skip(outputs('Compose-split_by_new_line'),1)
  • Map: To map the field column with value, after that, it will return an array.
KeyValue
outputs(‘Compose_-get_fields_name’)[0]split(item(),’,’)?[0]
outputs(‘Compose_-get_fields_name’)[1]split(item(),’,’)?[1]
outputs(‘Compose_-get_fields_name’)[2]split(item(),’,’)?[2]
outputs(‘Compose_-get_fields_name’)[3]split(item(),’,’)?[3]
import csv file data to sharepoint list power automate

Step 6: Next, click on the +New step -> select Initialize variable action. Then provide the below information:

  • Name: Provide the name as Items.
  • Type: Select the type as Array.
import csv into sharepoint list power automate

Step 7: Now I will remove the last item from an array, it contains array value. So, click on the +New step -> click on the Apply to each action. Then provide the below information:

  • Select an output from previous steps: Provide the below expression:
take(body('Select'), sub(length(body('Select')),1))

Next, click on Add an action -> select ‘Append to array variable‘ action. Then provide the below information:

  • Name: Select items from the drop-down.
  • Value: Select the Current item from dynamic content.
power automate import data from excel to sharepoint list

Step 8: So, click on the +New step -> select Parse json action. Then provide the below information:

  • Content: Select the var from the dynamic content.
  • Schema: To get the schema, click on ‘Generate from sample‘ and then provide the output. Click on Done.
power automate import data from excel to sharepoint list

Step 9: At last, click on the +New step -> select Create item action. Then provide the below information:

  • Site address: Select the SharePoint site address.
  • List name: Select the List from the dynamic content
  • Title: Select the Username from dynamic content
  • Identifier: Provide the below expression from dynamic content.
items('Apply_to_each_2')['Identifier']
  • First name: Provide the first name from the dynamic content
  • Last name: provide the last name from dynamic content
import excel to sharepoint list power automate

Step 10: To run the flow, click on Save -> then click on the Test icon -> then select Manually -> click on the Test button. Next, configure the flow -> click on Run flow -> Click on Done.

See also  How to Create a Document Library in Power Automate?

Now you can see, the flow runs successfully and all the CSV data are saved into the SharePoint list automatically using Power Automate.

import data from excel to sharepoint list using power automate

Conclusion

In this Power Automate tutorial, we saw how to import csv data to a SharePoint list using Power Automate. So, I hope you got an idea on how to import data from Excel to a sharepoint list using power automate.

You may also like:

>