Sub topic 3
Understanding the file list
This chapter assumes you can open the Power Query editor and have connected to a folder with Data > Get Data > From File > From Folder. Before you combine anything, you should know what the file list contains. Every later step, including filtering and combining, works on this table.
What the connector returns
When you connect to a folder, Power Query shows a preview and offers Combine, Load and Transform Data. Choose Transform Data to see the file list in the editor. The list has one row per file. It does not have one row per record inside a file.
The connector uses the M function Folder.Files. It reads all files in the folder and all of its subfolders. This is the source of many surprises later.
The columns
| Column | What it holds |
|---|---|
| Content | The file's raw bytes, shown as `Binary`. It is not parsed yet. |
| Name | The file name with its extension, such as `2026-01.csv`. |
| Extension | The extension with a leading dot, such as `.csv` or `.xlsx`. |
| Date accessed | When the file was last opened. |
| Date modified | When the file was last saved. |
| Date created | When the file was created. |
| Attributes | A record of flags, such as whether the file is hidden or read-only. |
| Folder Path | The full path of the folder holding the file, ending with a backslash. |
Content is the column that matters most. The other columns describe the file and help you decide which files to keep.
Reading the file list in M
You can see the same table in M. This query lists the files and keeps only the columns that describe them:
let
Source = Folder.Files("C:\Data\Sales"),
Described = Table.SelectColumns(Source, {"Name", "Extension", "Date modified", "Folder Path"})
in
DescribedRemoving Content here is only for inspection. A query that combines files needs Content, because it holds the data.
Checking the list before you combine
Look through the list for these problems:
- Unexpected extensions. A
.txt,.zipor.dbfile in the folder will appear as a row. - Temporary files. When someone has an Excel workbook open, Excel creates a hidden file whose name starts with
~$. It appears in the list with a few bytes of content and fails to parse. - Files in subfolders. Check the
Folder Pathcolumn. If you see paths deeper than the folder you chose, files from subfolders are included. - Duplicates or old versions. Names like
Sales_final_v2.csvsuggest files you may not want.Date modifiedhelps you tell them apart.
The next chapter uses these columns to filter the list so that only the intended files remain.
Exercise
You connect to C:\Data\Sales and the file list shows 14 rows, but the folder shows only 12 files when you open it in File Explorer. Which two columns would you check first to find the extra rows, and what is the likely cause?
Show answer
Check Folder Path and Name. Folder.Files includes files from all subfolders, so a deeper Folder Path shows files from a subfolder. A Name starting with ~$ shows a temporary file created by an open workbook. Both are invisible or easy to miss in the main folder view.