Forum Discussion
mwig
8 years agoNew Member
How to Auto Fill Column Titles With Row Text
Hello community, I am faced with a couple hundred files which are to be imported to Power BI and I must rename the columns based on the 2rd row in each sheet. What is the best way to automate th...
ImkeF
8 years agoCommunity Champion
Hi mwig
the following function renames all columns from a table (Source) to its values from the 2nd row:
Table.RenameColumns(Source, List.Zip( { Table.ColumnNames(Source), List.Transform(Record.FieldValues(Source{1}), Text.From) } ))is this what you're looking for?
- mwig8 years agoNew Member
How do I input that into the sheet?
- ImkeF8 years agoCommunity Champion
Please check out this video with instruction on how to integrate M-code into your solution:
- mwig8 years agoNew Member
When I entered the exact formula you posted it gives me an error message and then the entire sheet disappears. I'm sure I have to do some changes to the formula but why would it disable the entire sheet if I type it in wrong?