Downloads
Power Query MData sourcesIntermediate

Folder.Contents

Lists everything in a folder, both files and subfolders, so you can see the folder's structure before you choose what to load.

Syntax
Folder.Contents(path)

Returns: A table with one row for each file and each subfolder, including Name, Attributes and Content.

What it does

Folder.Contents lists what is in a folder, and the subfolders as well. Each subfolder appears as a row whose Content is another folder table, so you can move down the tree. Use it when your files are sorted into subfolders by year or entity and you need to pick a branch of the tree. For a simple flat folder, Folder.Files is usually the better choice.

Syntax and arguments

Example

Monthly files are kept in subfolders by year, such as 2025 and 2026. The query finds the 2026 subfolder and then lists the files in it.

let
    Root = Folder.Contents("C:\Finance\Archive"),
    Year2026 = Root{[Name = "2026"]}[Content],
    Files = Table.SelectRows(Year2026, each [Extension] = ".csv")
in
    Files

Root lists the year folders, [Name = "2026"] selects one, and its Content is the table of files inside. The filter then keeps the CSV files.

Example: a second, different use

Listing every file across all subfolders by combining the Content of each subfolder row, when you need one list rather than a tree.

Things to watch

In business terms

Archives organized by year, entity or period are common in audit and close files. Navigating with Folder.Contents lets the query follow the same structure the team uses to file its work.

Related functions

All Power Query M functions · View as Markdown · M basics