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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How do you change Column Names during Import on CSV (Managing changing column names)

Hi,

 

 

I would have thourght this is a common problem but I can't find any thing here.

 

Enviroment:

 

Pulling hundreds of CSV files from Sharepoint that have over time had some of the Column Names changed.

 

Requirement:

 

Whilst importing each file update any of the old column headings to the current headings.

 

Issue

 

I have a solution below but it is VERY VERY VERY slow when it executes and looking at  Resource Monitor Microsoft.Mashup is hammering my memory with hard faults.

 

Question:

 

Is there a better way to do this that would be more efficient?

 

Current Code

 

    #"Transform to CSV: Create import column" = Table.AddColumn(#"Removed Columns", "Transform File from Binary",
      each let
            Source = Csv.Document([Content],[Delimiter=",", Columns=85, Encoding=1252, QuoteStyle=QuoteStyle.None]),
            #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
            #"Rename Column" = Table.RenameColumns(#"Promoted Headers",{
                {"Thick1","S1_THICK1_RATE"},
                {"Thick2","S1_THICK2_RATE"},
                {"Thick3","S1_THICK3_RATE"},
                {"Thick4","S1_THICK4_RATE"},

                {"Length1","S1_LENGTH1_RATE"},
                {"Length2","S1_LENGTH2_RATE"},
                {"Length3","S1_LENGTH3_RATE"},
                {"Length4","S1_LENGTH4_RATE"},

                {"PickFail1","S1_PICKFAIL1_RATE"},
                {"PickFail2","S1_PICKFAIL2_RATE"},
                {"PickFail3","S1_PICKFAIL3_RATE"},
                {"PickFail4","S1_PICKFAIL4_RATE"},

                {"Purge","S1_PURGE_RATE"},

                {"Shutter","S1_SHUTTER_RATE"}
                    },MissingField.Ignore)
                           
        in
        #"Rename Column"),
    #"Expanded Transform File from Binary" = Table.ExpandTableColumn(#"Transform to CSV: Create import column", "Transform File from Binary", {"CustomerID", "ETC ETC ETC"}),
  

 

Regards

 

Andrew

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

It seems you may delete changed type under applied steps in query editor window. If it is not your case, please check if this post can help you.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous

 

Could you tell me if your problem has been solved? If it is,kindly mark the helpful answer as a solution and welcome to share your own solution. More people will benefit from here. If not, please share more details for us so that we could help further on it.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.