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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to parse csv's to SQL
Power Automate
Answered

How to parse csv's to SQL

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

This might already be out there somewhere, but just figured it out in case someone needs it. 

 

Scenario:

- .csv file uploaded to Azure Blob Storage

- Need to parse .csv and write new records to Azure SQL

 

Solution:

Trigger: Blob added to container

Control1: FOR ALL blobs added, `createArray(triggerBody()?['Path'])`

Control2: IF `CurrentItem ends with .csv`

Action1: Get Blob Content Using Path `CurrentItem`

Action2: Compose `body('Action1')`

Action3: (The first secret ingredient) Compose "@split(outputs(Action2, '\r\n')"

  - The key here, is that you MUST actually type the above into the Compose inputs box NOT THE EXPRESSION FIELD

  - See "Step 2" here: https://dynamicscitizendeveloper.com/2019/06/06/microsoft-flow-csv-integration-with-dynamics-365/

Control3: FOR ALL Action3, `skip(outputs(Action3, 1))`

  - This skips the header row in the .csv

Control4: IF `CurrentItem is not equal to "" `

  - For some reason, Action3 generates an additional blank row. This filters the blank row out.

Action4: (The second secret ingredient) Insert Row (SQL) 

  - In each SQL table column field, you need to add the expression `split(items('Control3'), ',')?[X]`

  - Where "[X]" = the position within the split array that needs to map to that given SQL column

 

Looks like this:

 

 

Hope this helps!

Categories:
I have the same question (0)
  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @ericonline,

     

    Thanks for your solution that parse csv's to SQL, you've done a lot for the community.
    You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

    Best Regards,
    Community Support Team _ Lin Tu

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I actually don't see the "Accept as Solution" button on my post. You'll have to click it!

     

    Also, screenshots of the Flow are not showing up under "Looks like this:" in my original post. Weird.

  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @ericonline,

     

    The screenshot couldn't be seen, you could edit the original reply and insert them.

     

    Best Regards,
    Community Support Team _ Lin Tu

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    As I mentioned, when I try to insert screenshots into the Original Post, it does not work.

     

    Here is proof:

    image.pngimage.pngimage.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    image.pngimage.png

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard