• Antriksh Sharma

Dynamically change column names in Power Query using predefined values

In Power Query if you want to change names of columns you can easily do so by going through each column one by one and then renaming them, but sometimes this can be a bit tedious.

If you happen to know that the columns in your model won't change, meaning the columns won't be removed or added then you can use this trick of changing the column names without going through the hassel of naming them one by one.

To begin with you need a small dataset:

Next create a list of values using curly braces, these values will act as the new names of the columns

Now fetch the names that are currently applicable to the columns

Next, we need to zip the new names and the old names together using List.Zip

Now all the needs to be done is to apply this zipped list to the column names using Table.RenameColumns function.

71 views0 comments

Recent Posts

See All