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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

how to split the csv file to array in microsoft flows

(0) ShareShare
ReportReport
Posted on by 85

Hi,

i have used the split(outputs('CSV_Data'),'\r\n') expression to split the csv file into array but i am getting the result in single line instead of multiple lines, see screenshotsflow-img1.PNGflow-img.PNG

kindly help me in sorting out this issue.

thanks .

I have the same question (0)
  • Abigail Profile Picture
    552 on at

    The short answer is that there is not currently a csv parsing function in Flow.  The somewhat longer answer is that depending on how reliable your csv content is, it may be possible. You'd need to write some loops to create an array of json objects that contain your data... then you could parse through the json more or less normally.

    Edit 1: I found this may help you.

    https://dynamicscitizendeveloper.com/2019/06/06/microsoft-flow-csv-integration-with-dynamics-365/

  • Suggested answer
    Tapon Profile Picture
    5 on at

    Use "@split(outputs('CSV_Data'),'\n')" 

  • Suggested answer
    BrandonHoward Profile Picture
    5 on at

    Put "@split(outputs('CSV_Data'),',\r\n')" directly in the inputs box instead of in the expression box. Also include the ampersand and double quotes

  • Community Member Profile Picture
    on at
    Try this out:
    @echo off
    setLocal EnableDelayedExpansion
    
    set limit=20000
    set file=export.csv
    set lineCounter=1
    set filenameCounter=1
    
    set name=
    set extension=
    for %%a in (%file%) do (
        set "name=%%~na"
        set "extension=%%~xa"
    )
    
    for /f "tokens=*" %%a in (%file%) do (
        set splitFile=!name!-part!filenameCounter!!extension!
        if !lineCounter! gtr !limit! (
            set /a filenameCounter=!filenameCounter! + 1
            set lineCounter=1
            echo Created !splitFile!.
        )
        echo %%a>> !splitFile!
    
        set /a lineCounter=!lineCounter! + 1
    )
    

    As shown in the code above, it will split the original csv file into multiple csv file with a limit of 20 000 lines. All you have to do is to change the !file! and !limit! variable accordingly. Hope it helps.

  • VincentM35 Profile Picture
    5 on at

    Hello guys,

    How could i split a CSV file using both Return and Tab separator?

    i tried "@split(outputs('CSV_Data'),',\r\n')"  and it works for the return but i am still stucj with the tab separaror

    Thanks for your help

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 80

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans