Keep SharePoint File Names When Combining Files in Excel Power Query
Question details
Keep the original SharePoint workbook name on every row when combining files in Power Query.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- Combining workbooks from a SharePoint folder and retaining their names for traceability or date extraction.
- Observed behavior
- The original file name is missing from the combined rows.
Confirm that you can access the SharePoint site and that the workbooks have a consistent structure. Identify the site URL and the folder path you want to filter in Power Query.
Preserve the file name before expanding combined data
Keep file metadata alongside each transformed table so the source name appears on every expanded row.
In Excel, select Data > Get Data > From Online Services > From SharePoint Folder. Enter the SharePoint site URL, sign in if prompted, and select Transform Data.
In Power Query Editor, use the Folder Path filter to select the folder containing the workbooks. Filter the Name or Extension column as needed to exclude unrelated files.
Use the Combine Files button in the Content column header and select the worksheet or table to import. The combine process creates a sample-file transformation and a function for applying it to the files.
In the main query, review Applied Steps and find the step before the transformed tables are expanded. Keep the file Name column, or the Source.Name column if Power Query renamed it, and rename it SourceFile. Edit or remove a column-selection step if it removed the name.
Select the expand button in the transformed table column header and choose the data columns to import. Power Query repeats SourceFile for each expanded row from that file.
If the filename contains a date, select SourceFile and use Add Column > Extract to isolate the relevant text, then set an appropriate data type. Select Home > Close & Load when the result is ready.

Work with combined spreadsheet data in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface. Open compatible Excel files and work with combined data in WPS Spreadsheets for an easy transition from Microsoft Office. It does not fix Excel Power Query or replace the SharePoint combine workflow described above.

Frequently Asked Questions
Why did the file name disappear after I combined the files?
A generated or edited step may have removed the Name or Source.Name column. In Power Query Editor, check Applied Steps before the transformed table is expanded and keep that column in any column-selection step.
How can the filename appear on every imported row?
Keep the filename column alongside the transformed table column, then use the table column's expand button. Power Query repeats the filename for each row expanded from that file.
Can I extract a date from the SharePoint filename?
Yes. After retaining the filename as SourceFile, select it and use Add Column > Extract to isolate the date text. Set the resulting column to a date type if the text can be interpreted as a date.
Which SharePoint URL should I enter?
In Data > Get Data > From Online Services > From SharePoint Folder, enter the SharePoint site URL rather than an individual workbook URL. After connecting, filter Folder Path to the folder you need.




