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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
cristianml
Post Prodigy
Post Prodigy

Pickup Folder with Power Query

Hi team,

 

I was trying to find a way to use a pick up folder option like with a Macro but using Power query.. Is this possible ?

 

This is a code in VBA to pick up folder. I would like to replace this using power query and also using with RELATIVE FILE PATH : 

 

VBA CODE:
'Retrieve Target Folder Path From User
Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)

With FldrPicker
.Title = "Select a Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo NextCode
myPath = .SelectedItems(1) & "\"
End With

'In Case of Cancel
NextCode:
myPath = myPath
If myPath = "" Then GoTo ResetSettings

'Target File Extension (must include wildcard "*")
myExtension = "*.xls*"

'Target Path with Ending Extention
myFile = Dir(myPath & myExtension)

 

The idea is to use a this FileDialog folder picker option but in power query and combine it with the normal option in power query that is to get data from a Folder option. 

 

Any ideas ? Thanks.

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello

 

this dialog box can't be replaced by PQ.

Possible solution is

- use vba and the filedialog

- use the output of the vba to fill a table.

- read this table and use it as parameter for the folder-function.

 

you can write a VBA that after filling the path-information to the table, runs automatically a refresh of the PQ.

 

If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

View solution in original post

2 REPLIES 2
Jimmy801
Community Champion
Community Champion

Hello @cristianml 

did my proposal help you?

Bye

Jimmy

Jimmy801
Community Champion
Community Champion

Hello

 

this dialog box can't be replaced by PQ.

Possible solution is

- use vba and the filedialog

- use the output of the vba to fill a table.

- read this table and use it as parameter for the folder-function.

 

you can write a VBA that after filling the path-information to the table, runs automatically a refresh of the PQ.

 

If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.