web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to import a CSV fi...
Power Automate
Answered

How to import a CSV file to Sharepoint list

(0) ShareShare
ReportReport
Posted on by 81

I have a CSV text file that is semicolon separated which I'm trying to import to Sharepoit list using power automate flow.

The file contains one header line and the rest is the data.

 

I'm new at this so I have googled several solutions to end up with the following which I need the help with.

 

1. Each day I'll have a new file that need to be imported, adding new lines to the Sharepointlist

2. The filename is always the same

 

Following is only the flow-part where I'm trying to read/parse the CSV file.

 

Zoran_0-1629829615067.png

 

split(outputs('Get_file_content')?['body'],outputs('newLine'))
split(first(outputs('splitByLines')),';')
 
This error appears when the flow tries to run "splitByLine"...
 
Zoran_0-1629832544872.png

 

 
So what is wrong here??? Why am I getting this error?
Categories:
I have the same question (0)
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Zoran 

     

    Without seeing the content of your file, it is suggesting that an object { } is being returned from get file content and not a series of ; seperated strings on seperate lines.

     

    You can check this in the history of get file content or by inserting outputs('Get_file_content')?['body'] into a compose.

     

    Then, once you have split your file into an array of lines, you cannot then split the new array of lines further without using an action like a select.

     

    This would be a good place to look for an explanation https://www.damobird365.com/parse-a-csv-to-json-array-quickly/ 

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • Zoran Profile Picture
    81 on at

    Hi DamoBird365

    Thanks for replaying to may question 😀!

     

    I have checked the logg, tested the DamoBird365CompleteSolution and the following input/output is what I am getting. Could it be that the issue is because my file is semicolon separated?

     

    Zoran_0-1629835789134.png

     

    BR/Zoran

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Zoran 

     

    I am not sure about your error.  I created a basic proof of concept which you can copy below and paste into flow via new action my clipboard.  This will give you a scope, with a sample ; seperated file, a return in a compose, a split on return and a select.  Note that in the select, I have skpped the first line and then used this as the key names.  I have also used the expression json() to demonstrate how to skip escaped quotes.

     

    {"id":"7915fc42-9ab9-48ec-b855-f752-8da083f9","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365_SplitAndSelect","operationDefinition":{"type":"Scope","actions":{"FileContent":{"type":"Compose","inputs":"\"Header1:\";\"Header2:\";\"Header3\"\n\"123\";\"abc\";\"098\"\n\"456\";\"poi\";\"765\"","runAfter":{}},"Compose":{"type":"Compose","inputs":"\n","runAfter":{"FileContent":["Succeeded"]}},"Select":{"type":"Select","inputs":{"from":"@skip(outputs('Compose_2'),1)","select":{"@{json(split(first(outputs('Compose_2')),';')[0])}":"@json(split(item(),';')[0])","@{split(first(outputs('Compose_2')),';')[1]}":"@split(item(),';')[1]","@{split(first(outputs('Compose_2')),';')[2]}":"@split(item(),';')[2]"}},"runAfter":{"Compose_2":["Succeeded"]}},"Compose_2":{"type":"Compose","inputs":"@split(outputs('FileContent'),outputs('Compose'))","runAfter":{"Compose":["Succeeded"]},"description":"split(outputs('FileContent'),outputs('Compose'))"}},"runAfter":{}}}

     

    Please let me know how you get on.

     

    Damien

  • Zoran Profile Picture
    81 on at

    Thanks again,

     

    Unfortunately for some reason I cant get it to run with my file...

     

    I sent you a PM because I prefer not to share the file content publicly.

     

    Could you please take a look at the file?

    I suspect it may be some issue with the file...

     

    BR / Zoran  

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hey @Zoran 

     

    Try this :

     

    DamoBird365_0-1629840608619.png

     

    base64tostring(outputs('Get_file_content')?['body']?['$content'])

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • Zoran Profile Picture
    81 on at

    This helped 😀!

     

    However I was not able to list all 17 columns, it complained after 9 splits in the "Select"

    Zoran_2-1629847647530.png

     

    //Z

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Morning @Zoran 

     

    It means that your row doesn’t have more than 10 splits. A way to avoid that error is to insert a ? Between [‘fieldname’]?[0] a ? Will return null if no value is returned. Maybe some lines don’t have 10 ; and so it cannot split beyond that limit without error. 

    Damien

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard