Forum Discussion
How to extract all the column names from a 'Table' data Type Column ?
- 5 years ago
Hi, Sayri , it's easy to extract all columns' names from each table in your scenario; you might add applied steps like this,
#"Column Names" = Table.TransformColumns(#"Previous Step", {{"Data", Table.ColumnNames}}), #"Expanded Data" = Table.ExpandListColumn(#"Column Names", "Data") - 5 years ago
Hello Sayri
you can transform you tables first to get the first row of your tables as new table with Table.First and Record.ToTable.
Then expand the newly created table. here an easy example
let Source = #table({"Index", "Data"}, {{"Index0", #table({"ColumnA", "ColumnB"}, {{"A", "B"}, {"C", "D"}})}, {"Index1", #table({"Column1", "Column2"}, {{"E", "F"}, {"G", "H"}})}}), GetFirstRowOfTable = Table.TransformColumns ( Source, { { "Data", each Record.ToTable(Table.First(_)) } } ), #"Expanded Data" = Table.ExpandTableColumn(GetFirstRowOfTable, "Data", {"Name", "Value"}, {"Column name", "First row value"}) in #"Expanded Data"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Sayri
you can transform you tables first to get the first row of your tables as new table with Table.First and Record.ToTable.
Then expand the newly created table. here an easy example
let
Source = #table({"Index", "Data"}, {{"Index0", #table({"ColumnA", "ColumnB"}, {{"A", "B"}, {"C", "D"}})}, {"Index1", #table({"Column1", "Column2"}, {{"E", "F"}, {"G", "H"}})}}),
GetFirstRowOfTable = Table.TransformColumns
(
Source,
{
{
"Data",
each Record.ToTable(Table.First(_))
}
}
),
#"Expanded Data" = Table.ExpandTableColumn(GetFirstRowOfTable, "Data", {"Name", "Value"}, {"Column name", "First row value"})
in
#"Expanded Data"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy