Add Source File or Table Names in Excel Power Query
Question details
Add a column that identifies the source workbook, worksheet, or table for each row appended in 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.
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.
Retain the source file name when combining a folder
Use folder metadata to add each workbook's file name dynamically to the combined rows.
In Excel, select Data > Get Data > From File > From Folder, choose the folder, and select Combine & Transform Data.
In the Combine Files dialog, select the worksheet or table to import and confirm to open the combined query in Power Query Editor.
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.
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.

Add dynamic worksheet or table names from folder files
Use workbook metadata when rows need both a file name and the name of the worksheet or table they came from.
Add a fixed table name to a custom column
Use a constant label when a query always imports one known table.
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.

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.




