web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • VincentM35 Profile Picture
    5 on at
    RE: how to split the csv file to array in microsoft flows

    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

  • Community Member Profile Picture
    on at
    RE: how to split the csv file to array in microsoft flows
    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.

  • Suggested answer
    BrandonHoward Profile Picture
    5 on at
    RE: how to split the csv file to array in microsoft flows

    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

  • Suggested answer
    Tapon Profile Picture
    5 on at
    RE: how to split the csv file to array in microsoft flows

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

  • Abigail Profile Picture
    552 on at
    RE: how to split the csv file to array in microsoft flows

    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/

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 394

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 123

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 106 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans