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 replace header ...
Power Automate
Answered

How to replace header values

(0) ShareShare
ReportReport
Posted on by

Hi,

 

  I have a .csv file and have the first row as the header and need to replace the text to rename the columns.

 

  Example, is I have a column called "Issue_Key" and I need it to say "Key" (I have other columns as well I need replaced)

 

  Also,  I only want it in the header row and not in the stream of data, so if a record contains "Issue_Key", leave that as is.

I have the same question (0)
  • cwischnewski Profile Picture
    162 on at

    I think you would have to open the file, create another file, read the first line and do string replacements or just hard code your string for the new header, then write to the new file.  Then read the remaining file and write it to the new file.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    The correct way to do this would be to read the entire data, do the modifications in the variable and then overwrite the file with new data. 

     

    Use Read from CSV file to read it. Enable the toggle to retrieve first row as headers. You'll end up with a data table in %CSVTable%. You can then use %CSVTable.Colums% to get the column names into a list. You can use Replace text on it to replace values as needed. But this will convert the list into a string. So, you'll need to use Split text on it afterwards to split it into a list again. 

     

    Finally, write the resulting list into a new CSV file via Write to CSV file. Then, after you've done that, write the entire %CSVTable% in it, appending the values. When you write a data table and make it not include header row, it will only write the data. So, the headers you wrote previously will not be overwritten.

     

    You can then move/rename this file to the location of the original file to replace it. Or you could just make the initial Write to CSV file action (that writes the headers) overwrite the original data.

    -------------------------------------------------------------------------

    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

     

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • AP-03101741-0 Profile Picture
    on at

    What operation is "Read from CSV file" and "Write to CSV file" under ?

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    It's under the "File" action group. But you can simply use the search over the actions tree and search for "CSV" - the two actions will pop up.

  • AP-03101741-0 Profile Picture
    on at

    I see "Write to CSV file" in the IA-Connect Session action group only. I don't see "Read from CSV" anywhere ?

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Are you sure you are doing this in Power Automate Desktop and not cloud flows? These forums are for desktop flows.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 809

#3
Haque Profile Picture

Haque 645

Last 30 days Overall leaderboard