Forum Discussion
Power Query Editor Transform file helper Query folders
I have lots of files I have created from folders and now I have lots of these cluttering up power Query Editor
I really dont like it. Is there any way I can actually get rid of all these and get them down to just one, after its all been done by tweaking some code somewhere?
12 Replies
- lbendlinSuper User
These are meant for beginners. Once you checked how they work you will realize how inefficient they are, for example they use the "first" file as the blueprint for the column list of all the files - which may not be what you want. The also read that "first" file twice, for no good reason.
Replace them with your own, more streamlined code (via Table.AddColumn and Table.ExpandTableColumn) and then you can delete the groups.
- DebbieECommunity Champion
I wouldnt know how to do this. is there any documentation or anything I can use to replace the code and then get rid of these?
- lbendlinSuper User
here's the general process:
- connect to a folder type data source (file share or sharepoint folder)
- filter for the files you want to ingest
- click the "Binary" link for one of the files, and run the minimum required transform (usually promote headers)
- examine the resulting Power Query code in Advanced Editor and extract the transform step as a function
- remove the steps for the single file
- add a column that calls the function for each of the files
- expand that column
- apply column type changes as needed
You can even specify the function inside the Power Query to keep everything in the same firewall partition.
What is your data source? File folder or SharePoint Document Library?