OpenBI Docs Buy

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
ParameterTypeDescription
pathtextThe folder's path.
optionsnullable 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.Contents gives for its path. A folder's Extension is empty, and its Attributes say Kind "Folder" and Directory true.
  • Folder.Files goes 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"})
NameExtensionKind
2026-01.csv.csvCSV File
2026-02.csv.csvCSV File
archive(empty text)Folder

Open a folder by its row

Folder.Contents("C:\Data\orders"){[Name = "archive"]}[Content][Name]
{"2025-12.csv"}

Folder.Files, File.Contents, DeltaLake.Table, Table.ToRecords.

Last updated · OpenBI Studio 0.3.79