Power Query – how to reference ALL columns in a table? The Table.ColumnNames function
In Power Query, sometimes we need to do some change for ALL columns in a table.
But we don’t want to address them one by one, for two reasons:
- It can be unnecessarily lengthy
- The columns may vary in time
If we want, for example, in this table:
fill down all empty cells, we don´t have to write this:
- Source = Excel.CurrentWorkbook(){[Name=”Table1″]}[Content],
#”Filled Down” = Table.FillDown(Source,{“Blue”, “Red”, “Grey”})
we can use this:
- Source = Excel.CurrentWorkbook(){[Name=”Table1″]}[Content],
#”Filled Down” = Table.FillDown(Source,Table.ColumnNames(Source))
The typical use of Table.ColumnNames is for expanding columns from merged tables.