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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Folder Select set of xlsx files based on user input

Need Help on

Connect to the folder load only the files specified in the config excel. Need to write a custom function which on invocation should take the binary of the file perform sheet navigation promote headers and return the excel table.

For example: if the folder has 3 xlsx files i.e 1.xlsx, 2.xlsx, 3.xlsx and if the config file has only 1.xlsx and 3.xlsx (it should take this config as input and custom function should automatically invoke)

Note: All the files in the folder has same metadata (headers)

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You don't need a custom function for this. You can do the following:

  1. Open the config file and get your file names as a single column in a table.
  2. Browse to the folder that has the 3 XLS files in it.
  3. Do an INNER JOIN with the table in the first step. Remove the "joined" column without expanding as it isn't necessary. The initial join did the filter for you.
  4. Now do the combine operation. It will only ever act on the files after the filtering has been done. Change the config file contents, and the combine will reflect that.


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

You don't need a custom function for this. You can do the following:

  1. Open the config file and get your file names as a single column in a table.
  2. Browse to the folder that has the 3 XLS files in it.
  3. Do an INNER JOIN with the table in the first step. Remove the "joined" column without expanding as it isn't necessary. The initial join did the filter for you.
  4. Now do the combine operation. It will only ever act on the files after the filtering has been done. Change the config file contents, and the combine will reflect that.


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Greg_Deckler
Community Champion
Community Champion

@ImkeF @mahoneypat @edhans 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler @edhans 

am completely new to this config file can you please help. Config will be like text file or xlsx or anything will do.

and with PBI> Getdata> folder> ??
Where to provide as inner join

I would use an Excel file. One file name per cell in a column.

 

Then either use the folder connector, or SharePoint.
I have a config file, so it may look like this:

edhans_0-1628790201788.png

Then I connect to SharePoint and it looks like this: (columns missing, but first few are all that are relevant. Same would apply to a local folder)

edhans_1-1628790241296.png

From here I merge as follows - clickiing Merge in the Power Query ribbon.

edhans_2-1628790301157.png

Now I have this. At this point, I just combine.

edhans_3-1628790348581.png

 

Changing the config file will change which files are kept on the next refresh.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.