List Files and Subfolders with Excel Power Query
Question details
Create an Excel listing of files and subfolders beneath a parent folder, including names, extensions, creation dates, and full paths.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- The user wants a refreshable folder inventory without manually entering each item or requiring administrator access.
- Observed behavior
- The desired result is a table of files and subfolders that can be refreshed when folder contents change.
Identify the full path of the parent folder and confirm that your account can read it and its subfolders. Power Query cannot list locations your account cannot access.
List files and all subfolders with a recursive Power Query
Use a recursive query when the inventory must include folder entries, including empty subfolders.
The standard From Folder connector lists files recursively, but it does not provide a separate row for every subfolder. This query uses Folder.Contents to include both files and folders.
In Excel, select Data > Get Data > From Other Sources > Blank Query.
In the Power Query Editor, select Home > Advanced Editor and replace the existing code with the following: let GetItems = (path as text) as table => let Items = Folder.Contents(path), Folders = Table.SelectRows(Items, each Value.Is([Content], type table)), Nested = List.Transform(Table.ToRecords(Folders), each @GetItems([Folder Path] & [Name])), Combined = Table.Combine({Items} & Nested) in Combined, Source = GetItems("C:\ParentFolder"), AddType = Table.AddColumn(Source, "Item Type", each if Value.Is([Content], type table) then "Folder" else "File", type text), AddFullPath = Table.AddColumn(AddType, "Full Path", each [Folder Path] & [Name], type text), Result = Table.SelectColumns(AddFullPath, {"Name", "Item Type", "Extension", "Date created", "Folder Path", "Full Path"}) in Result
Replace C:\ParentFolder in the code with your parent folder's full path, keeping it inside the quotation marks. Select Done.
Review or filter the columns in Power Query Editor, then select Home > Close & Load. To update the inventory later, select Data > Refresh All in Excel.

List files recursively with the From Folder connector
Use the standard connector for a simpler inventory when separate rows for empty subfolders are not needed.
Review Excel Folder Inventories in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar interface for opening and reviewing Excel workbooks. It supports common Office formats for easier migration, though it does not fix Microsoft Excel Power Query issues.

Frequently Asked Questions
Does Excel's From Folder connector include files in subfolders?
Yes. Select Data > Get Data > From File > From Folder and choose the parent folder. The resulting file list includes files in its subfolders.
Will empty subfolders appear in the standard file list?
No. The standard From Folder connector lists files, not separate rows for empty folders. Use the recursive Folder.Contents query above to include folder entries.
How do I update the list after adding or removing files?
In Excel, select Data > Refresh All to rerun the query and load the current folder contents.
Do I need administrator access to list the folder contents?
Not necessarily. Your account needs permission to read the parent folder and the subfolders being queried; inaccessible locations can cause the query to fail.




