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
hamid
Frequent Visitor

dynamic local drive path

hi erveryone

how i can dynamic my local drive path such as (C,D,E,) for import multi file into power query?

Best Regards!

1 ACCEPTED SOLUTION

Hi Frank!

Thanks for your answer.01.png02.png04.png

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @hamid,

 

Based on my test, we can use the Parameters to meet your requirement. Here I create a parameter like this.

 

1.PNG

 

After that we need to change the M code in the advanced editor, then we can choose the path that we want to import different files in power query. Please notice files will be combined within a given folder as long as they have the same file type and structure (such as the same columns). Here is the M code in advanced editor for your reference.

 

let
    Source = Folder.Files("file path\"& Parameter1),
    #"Invoke Custom Function1" = Table.AddColumn(Source, "Transform File from C (3)", each #"Transform File from C (3)"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from C (3)"}),
    #"Expanded Transform File from C (3)" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from C (3)", {"ID", "name"}, {"Transform File from C (3).ID", "Transform File from C (3).name"})
in
    #"Expanded Transform File from C (3)"

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Frank!

Thanks for your answer.01.png02.png04.png

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.