Folder.Contents
A folder's files and folders, one level only: a folder's Content is its own listing, to open in turn.
Group: Files and documents. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Folder.Contents(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. The eight columns of Folder.Files, a row per file or folder.
Remarks
- Files and folders are listed together by name, in the order Windows lists them (NTFS's), on every platform.
- A file's Content is its bytes; a folder's is the same table
Folder.Contentsgives for its path. A folder's Extension is empty, and its Attributes say Kind "Folder" and Directory true. Folder.Filesgoes down through every folder at once and lists files only.- A folder that isn't there is an error: DataSource.NotFound.
Examples
One level of a folder
Table.FromRows(
List.Transform(Table.ToRecords(Folder.Contents("C:\Data\orders")), each {[Name], [Extension], [Attributes][Kind]}),
{"Name", "Extension", "Kind"})
| Name | Extension | Kind |
|---|---|---|
| 2026-01.csv | .csv | CSV File |
| 2026-02.csv | .csv | CSV File |
| archive | (empty text) | Folder |
Open a folder by its row
Folder.Contents("C:\Data\orders"){[Name = "archive"]}[Content][Name]
{"2025-12.csv"}
Related functions
Folder.Files, File.Contents, DeltaLake.Table, Table.ToRecords.