Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How can I quickly create column names for 150+ columns using a file?

Hi everyone,

 

I am importing a text file, and I figured out the number of characters each column has and I filled in the custom delimiter field and everything is lined up nicely and makes sense. However, there are almost 180 columns and the data does not include a row I can promote to the title of each column in Power Query. I have an excel list that contains the name of each column, so I know what each one needs to be renamed to... is there a way I can have Power BI do this for me, rather than going into each column and manually renaming?

  • Hello Anonymous 

     

    yes, you can read the table of your excelfile in a own query. Then use the function provided by  Anonymous  to rename it. You basically have to transfor the column with new names to a list and name the query "newNamesList". Then the approach will work.

     

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Table.RenameColumns(yourTab, List.Zip({Table.ColumnNames(youTab), newNamesList}))

     

  • Jimmy801's avatar
    Jimmy801
    Community Champion

    Hello Anonymous 

     

    yes, you can read the table of your excelfile in a own query. Then use the function provided by  Anonymous  to rename it. You basically have to transfor the column with new names to a list and name the query "newNamesList". Then the approach will work.

     

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy