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 Apps / Read CSV File using Co...
Power Apps
Answered

Read CSV File using Column Header Names instead of column Index in Power Automate

(0) ShareShare
ReportReport
Posted on by

I have a  comma separated csv file like below  

EMPIDEmpNameEMPCountryEmpSalary 
1TarunINDIA100
2AlexUS300
3JohnUK200

currently we are  reading the same values  in power automate using the compose action  after skipping the first row and splitting the data  rows from the second row using comma(",") based on column Index 0,1,2 etc..

 

{
"EMPID": "@{outputs('splitByComma')?[0]}",
"EMPName": "@{outputs('splitByComma')?[1]}",
"EMPCountry": "@{outputs('splitByComma')?[2]}",
"EmpSalary ": "@{outputs('splitByComma')?[3]}",
}

 

Some the csv file may have the same  columns names but in the different order like below 

 

EmpNameEmpSalary EMPIDEMPCountry
Tarun1001INDIA
Alex3002US
John2003UK

 

so I need a way to get the cell values using Column Headers  instead of column Index in Power Automate

 

Any suggestion or approaches please. 

 

Thanks in Advance,

Tarun.

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @TarunEY ,

     

    The point is that convert the csv file into an array. I've made a test for your reference:

    vbofengmsft_0-1657261371623.png

    1\skip(split(variables('TheCSVFile'),decodeUriComponent('%0A')),1)

    2\split(split(variables('TheCSVFile'),decodeUriComponent('%0A'))[0],',')[0]
    3\split(split(variables('TheCSVFile'),decodeUriComponent('%0A'))[0],',')[1]
    4\split(split(variables('TheCSVFile'),decodeUriComponent('%0A'))[0],',')[2]
    5\split(split(variables('TheCSVFile'),decodeUriComponent('%0A'))[0],',')[3]

    6\split(items('Apply_to_each'),',')[0]
    7\split(items('Apply_to_each'),',')[1]
    8\split(items('Apply_to_each'),',')[2]
    9\split(items('Apply_to_each'),',')[3]

     

    The Result:

    vbofengmsft_1-1657261395234.png

     

     

     

     

    Best Regards,

    Bof

  • Vannieljevla Profile Picture
    53 on at

    This solution worked for me, thanks! For anyone wanting to shave off run time: you can put the code into a Select action, instead of an Apply to Each - Append to array variable. Since both are working with json, you shouldn't have to change your code.

     

    For my case, the runtime for this step reduced from 7 seconds to 2. I only have ~700 rows of data, but for larger data sets this can make a difference.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard