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

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:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    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

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard