For this you’re going to need to be familiar with what we did in the previous post as this post takes off where that one left off. So have a read of this first. How To Import All Files In A Folder With Power Query

Step 1: Create a query to get the named range.

Firstly create a named range to reference. I have called my named range FilePath and copied in a new folder location.

Now in Query Editor we can add in our M code to create our query function.

Close and load the new query.

Step 2: Edit our data query to use the new function.

Edit the data query.

Now we need to edit our query to remove the hard coded folder path location.

In the query preview you will notice the Folder Path field values have updated.

Step 3: Updating the query.

Now if you have a new folder with new data files in it, you’ll be able to easily change the import folder path and refresh the query.

How To Reference A Named Range In Power Query - 58