Forum Discussion
Brian_M
10 years agoContinued Contributor
Retain file name column when using Folder as a data source - Power Query M
Hi, Am hoping for some help. I will outline three steps below where I take a folder as a source, combine the binaries and then import. It all works fine, however, at the final step after I have ...
- 10 years ago
Actually, it's pretty easy with this line of code:
= Table.AddColumn(Source, "Custom", each Table.PromoteHeaders(Csv.Document([Content],[Delimiter=";", Encoding=1252])))
Replace your Step 2&3 with it.
It will retain all the metadata from the 1st step and add the content in an additional custom column.
If your csv's have all the same headers, you simply expand this column and the headers of the 1st file will be shown - and expand all other files on these cols as well.
If there are differnt cols - just come back & I'll post the code for the auto-expand of different headers.
ImkeF
10 years agoCommunity Champion
Hi Margaryta,
The error not recognize the name "Folder" refers to the name of the function (the name of the query):
So you either rename the function/query or edit your code to the name you gave it already.
Morvaryt
10 years agoFrequent Visitor
Thank you ImkeF, it works now. I appreciate your propmt response.
Regards,
Morvaryt