Power Query - Combine Data from Folder with Relative Paths


I have a folder (called Excel Exports) with a varying number of files within it, all the same format. This folder is distributed to many people, all residing on an unknown location on their local machine. The files within the folder are all the same format.


I am using the relative path workaround, where I have a table (named FolderPath) with a single record within my sheet that identifies the local path. Then I feed this local path into my Power Queries to run the Get Data From Folder query. This all works great. My source looks like this

Source = Folder.Files(Table.FirstValue(Excel.CurrentWorkbook(){[Name="FolderPath"]}[Content]) & "Excel Exports"),

The problem arises when I try to combine those files. All of the files are the exact same format, but with different data inside. When I run the Combine function, it gives me an error that says "We couldn't find an Excel table named 'FolderPath'."


I know the table is built properly, because that's the same table I'm referencing in my source, and it's working fine there. It appears that the Combine function does allow me to use this same workaround for some reason.


Any ideas?

3 Replies

Hi Justin,


please have a look at the following blog, which may be helpful


Later versions of Power Query automatically create a function to combine files excel files from folder.



best response confirmed by Justin Schmidt (Visitor)

Hi Justin,


Bit more in addition. Combine (clicking on Content column with binaries) doesn't work with file path defined as variable, it shall be the text. The approach is in link what Yury gave and more illustrative here (mainly second part of the post).


In brief, idea is to create the function which returns the table or the sheet (as you define the item to return) where the parameters for that function are file name and it's path. Instead of Combine you add custom column to your table with binaries into which that function returns tables from each file (taken file name/path as parameters from each row). After that expand that custom column and you are here.


I am doing add custom column but problem is the columns that get populated does not get refreshed when my source data files change. Even after refresh, column headers remain the same which existed in earlier files and not in the currently loaded files. Every time I have to delete expand query and add new Table expand from custom column to get correct data.


Any solution? May be if I can use  a function like select all columns from table.