Forum Discussion

MichaelW's avatar
MichaelW
New Member
10 years ago

How to format column header only (not data)?

Most of the columns in my Excel file have the date as a heading (formatted Mmm-YY in Excel).  They initially appear in the Power BI query as M/D/YYYY, but when I select "Use First Row as Headers" they change to ColumnX.  I could rename each one individually but that's tedious.  How can I format only the headers (the data itself isn't dates and is fine as is)?

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    The M code for renaming columns is:

     

        #"Renamed Columns" = Table.RenameColumns(#"PreviousStep",{{"OldColumnName", "NewColumnName"}}),

    Probably be a little more efficient to go into the Advanced Editor and copy and paste the rename columns M code.