Sub topic 3
Understanding the file list
This chapter assumes you can open the Power Query editor and select, filter, and sort columns in it. It also assumes you know the difference between a CSV file and an .xlsx workbook. Here you will learn what the table returned by the From Folder connector contains, so that later chapters on filtering and combining rest on something concrete.
The file list is a table of files
When you choose Data > Get Data > From File > From Folder and pick a folder, Power Query does not read any file yet. It returns a table with one row for each file it finds. Each row describes one file, and one column holds the file's raw bytes. Everything the combine step does later starts from this table.
You can see it in the dialog that appears before you commit. It shows the same table, with buttons for Combine, Load, Transform Data, and Cancel. Choosing Transform Data opens the table in the Power Query editor without combining anything. That is the best place to inspect it.
The query behind this table has one step, usually named Source. Its formula is:
= Folder.Files("C:\Data\Sales")Folder.Files takes a folder path as text and returns the file table. The rest of this chapter describes what that table holds.
The columns
The table has eight columns, in this order.
| Column | Type | What it holds |
|---|---|---|
| Content | Binary | The file's bytes, not yet interpreted as a table |
| Name | Text | The file name with its extension, for example `2026-01.csv` |
| Extension | Text | The extension including the dot, for example `.csv` |
| Date accessed | Date/time | When the file was last opened or read |
| Date modified | Date/time | When the file's contents last changed |
| Date created | Date/time | When the file was created at its current location |
| Attributes | Record | A set of file properties such as size |
| Folder Path | Text | The folder that contains the file, ending in a backslash |
Content
Content shows the word Binary in every cell. A binary value is a block of bytes that Power Query has not parsed. Excel does not know whether it is a CSV, a workbook, or a PDF. Functions such as Csv.Document and Excel.Workbook take this value and turn it into a table. This is why combining is a two-stage job: first list the files, then parse each one.
Clicking the word Binary in a cell adds a step that opens that single file. This is useful for a quick look at one file. Do it only for exploring, because a step that hard-codes one file is not what you want in a combined query.
Name and Extension
Name includes the extension. Extension repeats the extension on its own, with the leading dot. Use Extension for filtering by type. Use Name for filtering by pattern, such as a prefix or a month.
Extension values keep the case of the file name. A file called REPORT.CSV has the extension .CSV, and the comparison [Extension] = ".csv" is case-sensitive in M, so it does not match that file. When files come from several people or systems, normalize the case before comparing:
let
Source = Folder.Files("C:\Data\Sales"),
CsvOnly = Table.SelectRows(Source, each Text.Lower([Extension]) = ".csv")
in
CsvOnlyThe three date columns
Date accessed, Date modified, and Date created come from the file system. Be careful with each one.
- Date modified is the most useful. It tells you which export is newest, and you can use it to keep only recent files.
- Date created is the moment the file appeared at its current location. Copying a file to a new folder usually sets a new creation time, so this value can be later than
Date modified. - Date accessed changes when something opens or reads the file. Operating systems may update it lazily or not at all. Refreshing your query can itself touch it. Do not build logic on this column.
Because file systems differ, treat all three as hints about the files. If the month matters to your analysis, put it in the file name or inside the data, and do not rely on a timestamp that a file copy can change.
Attributes
Attributes holds a record, which is a set of named fields. In the editor the cells show the word Record. The expand button at the top of the column lets you pick fields, and the available ones commonly include the file size and whether the file is hidden. Expand it when you want to find empty or oversized files. Otherwise you can leave it alone, and later chapters remove it before combining.
Folder Path
Folder Path is the full path of the folder that holds the file, and it ends with a backslash. For a file in the folder you connected to, it equals the path you typed, with a trailing backslash added if you did not type one. For a file in a subfolder, it is the subfolder's path. That makes it the column that tells you where each file really lives.
Because the path ends in a backslash, you build a file's full path by joining the two columns without adding a separator:
let
Source = Folder.Files("C:\Data\Sales"),
WithFullPath = Table.AddColumn(Source, "Full Path", each [Folder Path] & [Name], type text),
Kept = Table.SelectColumns(WithFullPath, {"Name", "Folder Path", "Full Path"})
in
KeptFolder.Files looks in subfolders
Folder.Files is recursive. It returns files from the chosen folder and from every folder beneath it. This surprises many learners, because the From Folder dialog looks like it is about a single folder.
Suppose C:\Data\Sales contains 2026-01.csv and a subfolder Archive containing 2025-12.csv. The file list has two rows. Both have Content, but their Folder Path values differ: C:\Data\Sales\ for the first and C:\Data\Sales\Archive\ for the second. If you combine without filtering, the archived data joins the result.
If you want only the top folder, filter on Folder Path:
let
Source = Folder.Files("C:\Data\Sales"),
TopLevel = Table.SelectRows(Source, each [Folder Path] = "C:\Data\Sales\")
in
TopLevelThe comparison must match exactly, including the trailing backslash and the letter case of the path. A mismatch gives zero rows and no error, so check the result after you write it.
Power Query also has Folder.Contents, which lists the immediate contents of one folder and does not descend. It is a different function with a different result shape, and the From Folder command does not use it. This tutorial uses Folder.Files throughout.
Files you did not expect
The list is what the file system reports, not what you see in your head. Three kinds of rows commonly appear without being invited.
- Temporary lock files. When someone has an Excel workbook open, Excel creates a hidden file beside it whose name starts with
~$. These files have the same extension as the real workbook, so a filter on.xlsxalone keeps them. Their contents are not a valid workbook, which causes errors on refresh. - Files from subfolders. As above.
- Other file types. A
Thumbs.db, a.txtnote, or a PDF in the same folder all get rows.
The cheap way to spot these is to look at the list before combining. Sort by Name, scan the Extension column, and check Folder Path for more than one distinct value. Chapter 4 covers the filters that deal with them.
Ordering and refresh behavior
The order of rows in the file list is whatever the file system returns, and it is not guaranteed. It often looks alphabetical, but you should not depend on it. If order matters, add an explicit sort:
let
Source = Folder.Files("C:\Data\Sales"),
Sorted = Table.Sort(Source, {{"Date modified", Order.Descending}})
in
SortedThe file list is also live. Each refresh calls Folder.Files again, so new files appear as new rows, deleted files disappear, and replaced files keep their Name with a new Date modified. You never edit the list by hand. Instead, you describe in steps which rows you want, and Power Query applies the same description to whatever is in the folder on each refresh.
A short worked check
Before moving to filters, run this checklist on any new folder query.
- Choose Transform Data in the From Folder dialog, not Combine.
- Confirm
Sourceis a singleFolder.Filescall with the right path. - Look at the
Extensioncolumn. Use the column's filter arrow to see the distinct values, and note any you did not expect. - Look at
Folder Path. Check whether there is more than one distinct value. - Sort by
Nameand look for names that start with~$. - Check
Date modifiedfor files that are much older or newer than the rest.
This takes a minute and prevents most of the errors that later show up as missing columns or failed refreshes.
Exercise
A folder C:\Data\Reports contains jan.xlsx, feb.XLSX, and a subfolder Old that contains dec.xlsx. You run Table.SelectRows(Folder.Files("C:\Data\Reports"), each [Extension] = ".xlsx"). Which files come back, and how would you change the query to return all three but only if the extension case is ignored, and then to return only the files directly in Reports?
Show answer
Only jan.xlsx and Old\dec.xlsx come back. feb.XLSX is dropped because the comparison is case-sensitive and its extension is .XLSX. Folder.Files includes the subfolder, so dec.xlsx is returned. To ignore case, compare Text.Lower([Extension]) = ".xlsx", which returns all three files. To keep only files directly in Reports, also require [Folder Path] = "C:\Data\Reports\", which returns jan.xlsx and feb.XLSX.
Exercise
Why is [Folder Path] & [Name] the correct way to build a full file path, and not [Folder Path] & "\" & [Name]?
Show answer
Folder Path already ends in a backslash, so adding another one produces a double backslash in the middle of the path.