Folder.Files
Every file in a folder and in the folders below it, a row each, with its bytes in Content.
Group: Files and documents. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Folder.Files(path as text, optional options as nullable record) as table
| Parameter | Type | Description |
|---|---|---|
path | text | The folder's path. |
options | nullable record optional | Accepted as Power Query writes it; none is read. |
Returns
table. Content (the file's bytes), Name, Extension, three dates (Date accessed, Date modified, Date created), Attributes (a record) and Folder Path.
Remarks
- The folder's own files come first, then each subfolder's, deeper and deeper; folders themselves are not rows. Names are in the order Windows lists them (NTFS's), on every platform.
- Folder Path is the file's folder ending in its separator; Extension is the part from the name's last dot, with the dot (".csv"), empty when there is none.
- Attributes holds twenty fields: Content Type, Kind ("CSV File", "Excel File" ...), Size, ReadOnly, Hidden and the other flags of the file system. The dates are local datetimes.
- To combine files of one layout, filter the rows (on Extension or Name), then read each Content with
Csv.Document,Excel.WorkbookorParquet.DocumentandTable.Combinethe tables.
Examples
The files below a folder
The folder holds two monthly files and an archive folder with one more.
Folder.Files("C:\Data\orders")[[Name], [Extension], [Folder Path]]
| Name | Extension | Folder Path |
|---|---|---|
| 2026-01.csv | .csv | C:\Data\orders\ |
| 2026-02.csv | .csv | C:\Data\orders\ |
| 2025-12.csv | .csv | C:\Data\orders\archive\ |
Every month's orders in one table
let
Files = Folder.Files("C:\Data\orders"),
Csv = Table.SelectRows(Files, each [Extension] = ".csv"),
Tables = List.Transform(Csv[Content], each Table.PromoteHeaders(Csv.Document(_), [PromoteAllScalars = true]))
in
Table.Combine(Tables)
| OrderId | Shop | Product | Amount |
|---|---|---|---|
| 1001 | Oslo | Chair | 120 |
| 1002 | Bergen | Desk | 250 |
| 1003 | Oslo | Lamp | 45 |
| 1004 | Trondheim | Chair | 120 |
| 998 | Bergen | Lamp | 45 |
The values are text, as Csv.Document reads them; a Changed Type step follows in a real query.
Related functions
Folder.Contents, Csv.Document, Table.Combine, File.Contents, Table.SelectRows.