To do something with a column in Power Query, you usually reference the name of the column and the action that should be performed.

But how to do it if you don’t know the name of the column, or it can vary in time? Well, you have to work with its order, i.e. work with the first, third, last…one.

In this case you can use this code to rename column, or, similarly, for any other task. :

  • = Table.RenameColumns(
       Source,
       {
       {Table.ColumnNames(Source){0},
       “New name”}})

“Source” is the name of previous step.