Forum Discussion
dataPhix
5 years agoFrequent Visitor
Power Query: Include all unique columns found in files from folder
I've recently run into an issue which hopefully is solvable. Currently, I have power query pointing at a folder containing several CSV files. This is normally no issue, however, in this instance n...
- 5 years ago
dataPhix
Can you paste this code and follow the steps to check if it works for you?
Enter your folder pathlet Source = Folder.Files("C:\xx\xx"), #"Removed Other Columns" = Table.SelectColumns(Source,{"Content", "Name"}), #"Added Custom" = Table.AddColumn(#"Removed Other Columns", "Custom", each Table.PromoteHeaders(Csv.Document([Content]))), Custom1 = Table.Combine({#"Added Custom"},{"Name", "Custom"}), #"Sorted Rows" = Table.Sort(Custom1,{{"Name", Order.Descending}}), #"Expanded Custom" = Table.ExpandTableColumn(#"Sorted Rows", "Custom", {"one", "two", "yes", "no", "may be", "three", "four"}, {"one", "two", "yes", "no", "may be", "three", "four"}), #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom",{"Name", "one", "two", "three", "four", "yes", "no", "may be"}), #"Sorted Rows1" = Table.Sort(#"Reordered Columns",{{"Name", Order.Ascending}}) in #"Sorted Rows1"________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
Anonymous
5 years agoNot applicable
try with
Table.Combine({Table1, Table2,Table3})