Reputation: 21
I'm starting to use Power Query in Excel 365 (desktop install). Is there a way to change the column name to append or prepend today's date to the column name? If the column is named "Size" I'd like the column to be named "Size_2019_04_18". The exact format of the date doesn't matter.
Upvotes: 1
Views: 1156
Reputation: 2019
1, Go to Power Query Editor
2, Go to Advanced Editor
3, add the code below (Case Sentitive):
Let
...
NewName = "Size_"&Date.ToText(DateTime.Date(DateTime.LocalNow())),
#"Changed Type" = Table.TransformColumnTypes(Sheet1_Table,{{"Size", Int64.Type}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Size", NewName}})
in
#"Renamed Columns"
Upvotes: 2