Power Query Problems

Add Source File or Table Names in Excel Power Query

Nimra MalikNimra Malik Nov 20, 2026 869 views

Question details

Add a column that identifies the source workbook, worksheet, or table for each row appended in Power Query.

Add Source File or Table Names in Excel Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
A user is appending data from multiple Excel files and wants to identify where each record originated.
Observed behavior
The combined results should include source identifiers without requiring a hard-coded file name in each query.
Before you start

Place the source workbooks in a folder and check which worksheet or table contains the data in each file. Review whether their column structures are compatible before combining them.

Solution 1Recommended

Retain the source file name when combining a folder

Use folder metadata to add each workbook's file name dynamically to the combined rows.

1
Connect to the folder

In Excel, select Data > Get Data > From File > From Folder, choose the folder, and select Combine & Transform Data.

2
Select the data

In the Combine Files dialog, select the worksheet or table to import and confirm to open the combined query in Power Query Editor.

3
Keep the file name column

In the combined query, locate the file metadata column, commonly named Source.Name. Check the Applied Steps pane and adjust any Choose Columns or Removed Other Columns step that excludes it.

4
Expand and load the results

Use the expand button on the imported data column if needed, keeping Source.Name alongside the expanded fields. Select Home > Close & Load to return the results to Excel.

Retain the source file name when combining a folder
File names versus sheet names: Source.Name typically identifies the workbook file, not the worksheet or table inside it. Use the worksheet or table metadata method below if you also need that identifier.
Free Microsoft Office alternative

Work with Excel spreadsheets in WPS Office

WPS Office is a free, lightweight alternative for everyday spreadsheet work. Its familiar interface and Microsoft Office format support make it easy to move existing files into WPS. It does not fix or replace Excel Power Query.

Open and edit Excel XLSX and XLS filesReview source-name columns in spreadsheet dataUse a familiar spreadsheet interfaceMove existing Office files into a lightweight workspace
microsoft office alternative - wps office

Frequently Asked Questions

Why is Source.Name missing from my combined query?

In Power Query Editor, inspect Applied Steps for a Choose Columns or Removed Other Columns step that dropped the file name. Modify that step to retain the folder's Name column, which may later be renamed Source.Name.

Does Source.Name show the worksheet name?

In a folder-combine query, Source.Name usually identifies the workbook file. To capture a worksheet or table name, use Excel.Workbook on the file's Content column and expand the Item and Kind metadata.

How do I add the same table name to every row?

Select Add Column > Custom Column in Power Query Editor and enter a text formula such as "Table1". This creates a fixed label rather than detecting the table name dynamically.

Will new files get a source name when I refresh?

Files added to the connected folder can receive their own file names on refresh, provided they are included by the query's filters and have a structure compatible with its transformation steps. In Excel, use Data > Refresh All.