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 Automate / How to replace column ...
Power Automate
Unanswered

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

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard