Skip to main content
Community site session details

Community site session details

Session Id : ay4Rcw2WkDAz+CT1JeD9Fj
Power Automate - Building Flows
Answered

Read CSV file and create/update list items with logic

Like (0) ShareShare
ReportReport
Posted on 4 Apr 2018 11:18:33 by 1,594

Hi all,

 

I have a CSV file in a SharePoint Online library.

I'd like to create a FLOW that goes through each line of the CSV file and, using a bit of logic, create or update items in a list.

 

By example, if my CSV file is the following:

Last name;First name;Email

SMITH;Allan;a.smith@outlook.com

DOE;John;jdoe@outlook.com

 

If a have a list with the following:

Last name | First name | Email

DOE | John | john.doe@hotmail.com

 

When I run the workflow, I'd like to do the following:

  • when processing first line of CSV file (SMITH), since it does not exist in the list -> creates a new item in the list for SMITH
  • when processing second line of CSV file (DOE), since it already exist but email is different -> update list item to set new email for John DOE

The resulting list would then look like this:

Last name | First name | Email

DOE | John | jdoe@outlook.com

SMITH | Allan | a.smith@outlook.com

 

Is this possible ? Anyone already done something similar ?

 

Thanks for the help,

 

Emmanuel

  • fritz77 Profile Picture
    6 on 25 Nov 2023 at 12:11:33
    Re: Read CSV file and create/update list items with logic

    Hi, I'm trying to use your solution but I get a strange behavior: the first 5 rows in Sharepoint list have one field empty while all the others show correctly the field value. I tried to re-run the flow starting from the same excel to update the values and I get the same result.

     

    I checked the input and output of every step of the flow and I can find the correct value in the correct field but not in the Sharepoint list. The excel file is correct, the value in this rows are formatted correctly and are all plain text.

     

    Any idea?

  • fritz77 Profile Picture
    6 on 25 Nov 2023 at 12:10:09
    Re: Read CSV file and create/update list items with logic

    Hi, I'm trying to use your solution but I get a strange behavior: the first 5 rows in Sharepoint list have one field empty while all the others show correctly the field value. I tried to re-run the flow starting from the same excel to update the values and I get the same result.

     

    I checked the input and output of every step of the flow and I can find the correct value in the correct field but not in the Sharepoint list. The excel file is correct, the value in this rows are formatted correctly and are all plain text.

     

    Any idea?

  • takolota1 Profile Picture
    4,898 Moderator on 29 Mar 2022 at 04:08:03
    Re: Read CSV file and create/update list items with logic

    Hello,

     

    Please see this template if you want to parse a CSV without 3rd party connectors. It works even if there are commas in the data.

     

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/CSV-to-Dataset/td-p/1508191

     

    For this use-case, you can insert a Filter array action after the last Select action to filter the Select output before parsing the JSON to dynamic content.

  • SergiPino Profile Picture
    6 on 15 Oct 2020 at 12:16:37
    Re: Read CSV file and create/update list items with logic

    for problem #2 you can use a flow trigger "when file is created"

    SergiPino_0-1602764100279.png

    then check if this file is the csv converted into .xlsx and if it's the case fire the rest of the flow.

     

    I did this on other flows and works like a charm.

  • Community Power Platform Member Profile Picture
    on 30 Aug 2019 at 03:47:12
    Re: Read CSV file and create/update list items with logic

    Using Shell Scripts you can. Unfortunately there is no such feature in Flow yet. I use VBA macros but that involves manual intervention.

     

    Cheers,

    Aamir

  • Community Power Platform Member Profile Picture
    on 28 Aug 2019 at 17:23:21
    Re: Read CSV file and create/update list items with logic

    can i set the power query to run twice a day?

  • Community Power Platform Member Profile Picture
    on 12 Aug 2019 at 01:46:42
    Re: Read CSV file and create/update list items with logic

    The feature is not available right now. I had a similar issue where I paste my csv in a SharePoint folder and I managed to build a workaround.

    1. Create an Excel file.

    2. Use PowerQuery to read the csv from the Sharepoint.

    3. Use flow to to read the queried table in Excel.

    4. Update/Replace the Csv as required.

     

    Cheers,

    Aamir

     

  • anton-khrit Profile Picture
    197 on 18 Jun 2019 at 09:01:17
    Re: Read CSV file and create/update list items with logic

    You can use Parse CSV action from Plumsail Documents connector. It allows you to convert CSV into an array and variables for each column. Please read this article demonstrating how it works.

     

    Then you can iterate through result array and create items in a SharePoint list according to your logic.

  • R3dKap Profile Picture
    1,594 on 02 Aug 2018 at 13:15:14
    Re: Read CSV file and create/update list items with logic

    Well, on my side I'll never get to the million records...

     

    On the other hand, I totally agree wih you @asdfaf4 about the fact that Excel file paths cannot be dynamic and that's really a pain... Hope this feature will come true one day...

  • asdfaf4 Profile Picture
    on 02 Aug 2018 at 02:51:35
    Re: Read CSV file and create/update list items with logic

    2 potential problems by converting to Excel...

     

    1. Limit of 1 million rows

    2. Using Excel in flow doesn't support dynamics path and filename, you have to select the file within flow.  This defeats the purpose of having a library where a flow fires when a new file being added.  Highly frustrating...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete