- Sep 2
Power Query Tip to Ignore Subfolders
- Neale Blackwood
- Data, Tips & Shortcuts, Power Query
- 0 comments
Using the From Folder option in Power Query allows you to import all the files from the selected folder and all its subfolders. What if you didn’t want the subfolders? There is a solution.
Sign up to hear about free Excel training.
I won't share your email with anyone.
1 min read
Hat tip to Chandeep Chabra for sharing this tip on LinkedIn.
The From Folders option allows you to specify a folder but it defaults to include all the subfolders.
To ignore the subfolders, you must edit the code created when you use the From Folder option.
Luckily it is an easy change.
To import subfolders Power Query uses the Folder.Files function – see below.
Edit the code in the Formula Bar and change it to Folder.Contents – see below.
The folders are listed as a Table in the Content column.
You can use the Extension column to filter them out as they have (blank) in the Extension column – see below.
Then you can work with the files in the folder selected.



