Skip to main content

Notifications

Community site session details

Community site session details

Session Id : kxWd5O2FfXryB9GXvnc+7w
Power Automate - Building Flows
Answered

Get data from CSV and create table

Like (0) ShareShare
ReportReport
Posted on 13 Apr 2023 22:05:17 by 145

I am trying to work through the process to update a list from CSV based on unique values.  I do NOT have a table, only a list.  The CSV file is saved from email as part of flow 1.  Flow 2 sees the new file, and now I want to get the content and create a table from CSV.  My next step would be to take the content output and use the Create CSV table, but the output from the get content is not the file data.  How to I get the columns and data from the CSV?

 

JTischler_0-1681423485402.png

 

  • JTischler Profile Picture
    145 on 17 Apr 2023 at 18:38:12
    Re: Get data from CSV and create table

    @grantjenkins GOT IT!!  It took a bit, I had hidden spaces in the 'Select' step that were causing the field to not be referenced, smh!!  I can't thank you enough for sticking through this thread, this will be a huge help to the team and our process.  Much appreciation @grantjenkins !!

  • JTischler Profile Picture
    145 on 17 Apr 2023 at 14:45:59
    Re: Get data from CSV and create table

    @grantjenkins @Nived_Nambiar Implementing the above, the filter array is not producing an output:

    JTischler_0-1681742097447.png

    JTischler_2-1681742495006.png

     

    Array is using the body of select

    JTischler_3-1681742495008.png

     

    And the body of Select Session ID (Select 3)

    JTischler_4-1681742495009.png

     

     

    In the item expression I have tried both variations of how Session ID is shown :

    JTischler_5-1681742605509.png

     

     

    JTischler_1-1681742450698.png

    I have confirmed that the 2 test rows from my CSV are not present in the SP list. Not sure what I am missing here

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 16 Apr 2023 at 08:29:29
    Re: Get data from CSV and create table

    Hopefully this is what you're looking for.

     

    For this example, I'm using the same flow as before but added more to it. I'm also using the following SharePoint List. I'm using Record Number - you would just need to change it to suit your fields.

    grantjenkins_0-1681632759460.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1681632807549.png

     

    Everything up to the Select is the same as what we had before.

     

    Get items returns all the existing items from our SharePoint List.

    grantjenkins_2-1681632866998.png

     

    Select Record Numbers retrieves all the Records Numbers from the list. Note that Map uses Text mode.

    grantjenkins_3-1681632938811.png

     

    Filter array Items to add filters out the records so only the ones that don't exist in the list are returned (the ones we need to add). IMPORTANT: From uses the output from Select. The condition uses the output from Select Record Numbers and the following expression to get the current Record Number.

    item()?['Record Number']

    grantjenkins_4-1681633510789.png

     

    Apply to each iterates over each of the items from Filter array Items to add.

    grantjenkins_5-1681633544506.png

     

    Create item adds each of the items that don't exist in the list (Record Number doesn't exist). It uses the following expressions.

    //Title (Name)
    item()?['Name']
    
    //Record Number
    item()?['Record Number']
    
    //Amount
    item()?['Amount']

    grantjenkins_6-1681633635316.png

     

    After the flow runs, we will have our additional fields added.

    grantjenkins_7-1681633687909.png

  • JTischler Profile Picture
    145 on 14 Apr 2023 at 17:29:39
    Re: Get data from CSV and create table

    @grantjenkins I think I am close, hopefully just a little more and I can get to the finish line!

    With your feedback I was able to get my csv data into a table.  I have built the rest of the flow to:

    Get list items, compare list column to table column, where the table row is not found create item.

     

    I am stuck on how to identify the columns in the table output??

     

    JTischler_0-1681493296199.png

     

     

  • JTischler Profile Picture
    145 on 14 Apr 2023 at 15:09:59
    Re: Get data from CSV and create table

    @grantjenkins Thanks so much!  I am probably in over my head.  I have a flow that saves (csv) file from email to folder (sharepoint). What I am ultimately after is once daily file is saved, to be able to update a sharepoint list with only specific data from rows where the unique identifier is not present in the list.  I have done some research and have been able to get the data using 'compose', but I need array to put into table to reference columns from file to list.  I don't know if it's in scope to screen share live, but I sure could benefit from a conversation!  Thanks again for the help!!

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 14 Apr 2023 at 15:00:58
    Re: Get data from CSV and create table

    Hopefully this is what you're looking for. It will extract the data from the CSV file and give you an array of objects that can be used to update a SharePoint List, etc. I'm not entirely sure what you want to do with the data once you have it.

     

    For this example, I'm using the following CSV file that contains three columns.

    grantjenkins_0-1681483643951.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1681483741189.png

     

    When a file is created (properties only) is set to look for files added to a folder called Assorted Files. I haven't put any checks to see if it was a CSV file - assuming only CSV files will be added here.

    grantjenkins_2-1681483807585.png

     

    Get file content uses the Identifier from the trigger.

    grantjenkins_3-1681483886678.png

     

    Filter array extracts out the data and removes the last empty row we get. The expressions used are:

    //From
    //converts the data to string, splits on new line, and skips the header row (only want the data)
    skip(split(base64ToString(body('Get_file_content')['$content']), decodeUriComponent('%0D%0A')), 1)
    
    //Condition
    trim(item())

    grantjenkins_4-1681484042268.png

     

    Select uses the output from Filter array and maps out the headers and values using the following expressions. This assumes I know what the headers are and they are always in the same order in the CSV. You would just increase the index for each new header (depending on your CSV).

    //Record Number
    split(item(), ',')[0]
    
    //Name
    split(item(), ',')[1]
    
    //Amount
    split(item(), ',')[2]

    grantjenkins_5-1681484153005.png

     

    After running the flow, I would get the following output.

    [
     {
     "Record Number": "1",
     "Name": "Bob",
     "Amount": "20"
     },
     {
     "Record Number": "2",
     "Name": "Jane",
     "Amount": "35"
     },
     {
     "Record Number": "3",
     "Name": "Joe",
     "Amount": "21"
     },
     {
     "Record Number": "4",
     "Name": "Bill",
     "Amount": "68"
     },
     {
     "Record Number": "5",
     "Name": "Andy",
     "Amount": "102"
     }
    ]

    grantjenkins_6-1681484291352.png

     

    I'm not sure what you want to do with the data once you have it in this form. If this is all you're after and can move on from here then all good. Otherwise let us know and we can help build out more for you.

  • JTischler Profile Picture
    145 on 14 Apr 2023 at 14:04:56
    Re: Get data from CSV and create table

    @Nived_Nambiar is that a premium connector?  I am not seeing a read option available in built in or standard.

  • JTischler Profile Picture
    145 on 14 Apr 2023 at 13:53:17
    Re: Get data from CSV and create table

    @grantjenkins Yes, headers would always be the same and no, there would not be commas in the data.

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 14 Apr 2023 at 09:35:00
    Re: Get data from CSV and create table

    Would the column headers in the CSV file attached to the email always be the same?

     

    Also, would any of your CSV data have commas within the values such as "Hello, my name is Bob"? Or just commas separating each of the values?

  • Nived_Nambiar Profile Picture
    17,497 Super User 2025 Season 1 on 14 Apr 2023 at 05:35:56
    Re: Get data from CSV and create table

    Hi @JTischler 

     

    I think you have to try this way.

     

    first rename file with .txt extension. like if the file name is data.csv , rename it to data.txt

    Read the renamed file content and then use this as input to create html table using Create HTML Table.

     

    Hope it helps 🙂

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started