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

How to replace column names in header row in csv file in cloud flow

(0) ShareShare
ReportReport
Posted on by

Hi,

 

  I have a cloud flow that is using 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.

Categories:
I have the same question (0)
  • cmht Profile Picture
    82 on at

    Hi @PowerTony 

    You need to generate and record script in Automate in Excel Online.

    When this is done, you may use action named "Run Script". (Excel connector).

  • AP-03101741-0 Profile Picture
    on at

    I'm new to PowerAutomate, how do I go about doing that ?

  • cmht Profile Picture
    82 on at

    Hi @PowerTony 

    I'm also new to PowerAutomate.

    You need to open your file using Excel Online.

    When opened: choose tab named automation:

    cmht_0-1703170601647.png

     

    Now select record actions:

    cmht_1-1703170678052.png

     

     

    Now Excel will "generate script" -> so do the operations you want to have (change the column name);

     

    In the right pane it will show you actions you did:

    cmht_2-1703170784929.png

     

    Now click on Stop:

    cmht_3-1703170845722.png

     

    Excel will show you the script name:

    cmht_4-1703170906374.png

     

    You can now exit Excel Online (it should autosave) and now you can run this script using:

    cmht_5-1703171019314.png

     

  • AP-03101741-0 Profile Picture
    on at

    Here is the issue with that, I am generating the file out of PowerBI and within the cloud flow I am using..here is my flow:

    PowerTony_0-1703174422548.png

     

  • Verified answer
    cmht Profile Picture
    82 on at

    Hi @PowerTony 

    You can still open the CSV file and record actions.

    Your scripts are stored not in the file, but globally.

    Script, once created, can be run on any Excel file.

    You may also need to convert CSV to Excel.

  • AP-03101741-0 Profile Picture
    on at

    Can i use this technique to reorder the columns as well ?

     

    My file at the end (.csv) is delimited, can I open this in Excel use the delimiter and reorder the columns and save as .csv again and record this action ?

  • cmht Profile Picture
    82 on at

    @PowerTony 

    Yes, you can. Delimiter is in the ribbon "Data" -> Text to columns -> choose delimiter.

  • AP-03101741-0 Profile Picture
    on at

    I don't have Excel online, just Excel desktop but I was able to get the "Record Macro" added as an option.

     

    So, for my step above "Export to file", I would change this from csv to xlsx and the next step after that is to run the script ?

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard