Fetch Files and/or Folders with Filtering and Masking: Power Query
Fetching list of Files in a folder is easy with Power Query, it is one of the built-in source types. However fetching list of folders is not a built-in function. In this post I’ll show you how to fetch list of files, and also fetch only list of folders. The method explained in a way that you can customize the code and apply any conditions as you want later on. Conditions such as File or folder name masking to fetch only names that contains special character strings.
Fetch All Files in a Folder
For fetching all files in a folder you can simply use the GUI Get Data, and under File, choose Folder
Browse for Folder
and then simply you will see list of all files.
As you see in the above table extracted, there is a column named Content, which has the content of the file. you can click on that to see content of the file if you want.
What is the M Code Written Behind the Scenes
The code behind the scenes for this transformation used Folder.Files function
Read the rest of blog post here:
https://www.radacad.com/fetch-files-andor-folders-with-filtering-and-masking-power-query