Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RobGer
Frequent Visitor

Rename Columns in Sample File Dinamically

Dear Colleagues,

 

I need to append together several excel files on a quarterly basis. The Date is structured the same way (4 columns, first the product, then one column for each month of the quarter, example: january, february, march, and then a total). The Problem I have, and why I can't just combine the files, is that the product column is named in some other way for each file.

I have extensively searched for a solution, but can't seem to find it on my own.

 

The files look like this:

File A Example:

Product TypeJanuaryFebruaryMarchTotal
Abonnement55515
Blog1218535
Video156

12

 

 

File B Example:

Row TypeJanuaryFebruaryMarchTotal
Product A20304090
Product B5102035
Product C57820

 

Expected Result:

ItemJanuaryFebruaryMarchTotal
Abonnement55515
Blog1218535
Video156

12

Product A20304090
Product B5102035
Product C57820

 

Thanks in Advance for the help!

4 REPLIES 4
AlienSx
Super User
Super User

@RobGer if you just want to rename first column to "Item" then

Table.RenameColumns(your_table, {List.First(Table.ColumnNames(your_table)), "Item"})

 

AlienSx
Super User
Super User

Hello, @RobGer 

let
    a = table_A,
    b = table_B,
    c_names = {"Item"} & List.Skip(Table.ColumnNames(a)),
    tbl = 
        Table.FromRows(
            List.Combine({Table.ToRows(a), Table.ToRows(b)}),
            c_names
        )
in
    tbl

Hello @AlienSx

I use as source a Sharepoint Folder, where I upload all the files each quarter. Wenn I pull this Folder into Power Query and combine, I get an error (presumably because of the Sheet name, as it is auto generated by the software from where the data comes from). So instead of directly combining the content of all Excel Files (which I can't because of the sheet names), how could I combine the files, independently of sheet name?

 

 

@RobGer I don't work with Sharepoint, can't help you with that, sorry ((

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors