Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Isambard
Helper I
Helper I

Power Query Custom Column with Data Source

Hi,

 

I'm hoping this is really easy for someone with more experience than me. I'm taking data from a few dozen excel spreadsheets, each with a 20 named tables. I have set this up in power query and the data is coming through - one power query table for each excel table which is what I want.

 

I would realy like to add a collumn to each table specifiying the name of the excel file it came from so I'll be able to slice this back out later on. Is there a simple function or toggle somewhere that would let me include the source file name with my data?

 

Thanks for any help.

1 ACCEPTED SOLUTION
Minseven07
Frequent Visitor

I see. Can you get your data in a folder then filter on that specific excel file? If yes, you will have access to the folder path and the file name.

 

Minseven07_0-1706610475874.png

 

View solution in original post

5 REPLIES 5
kleigh
Responsive Resident
Responsive Resident

The name of the Excel file doesn't come at the step of Excel.Workbook, it's one before when you have your folder of Excel files. I think the usual thing is to combine by drilling into the Binary column, but it's also possible to create a new custom column with Excel.Workbook([Content]), remove the file information you don't need (including the raw Content), then expand your custom column. You'll also need to expand and combine your Excel tables in a way that preserves the file information as a column.

Minseven07
Frequent Visitor

I see. Can you get your data in a folder then filter on that specific excel file? If yes, you will have access to the folder path and the file name.

 

Minseven07_0-1706610475874.png

 

This works perfectly. Thank you.

Minseven07
Frequent Visitor

in your query editor, when you get your source file, you have access to the folder path and the file name. You can maybe concatenate those column.
If this doesn't help, a pbix file whould be welcome

Thank you. I don't need the file path, just the name would be fine. But I'm not seeing an option to load either of them as collumns. Should this be in the window when I load the data?

 

Sorry I can't post the pbix as its confidential but here are some screenshots:

Isambard_0-1706609723486.pngIsambard_1-1706609821077.png

The data then loads with all the fields from the excel table but not the source name.

 

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.