Oct 24 2017
06:54 AM
- last edited on
Jul 12 2019
10:54 AM
by
TechCommunityAP
Oct 24 2017
06:54 AM
- last edited on
Jul 12 2019
10:54 AM
by
TechCommunityAP
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?
Oct 24 2017 10:42 PM
Hi Justin,
please have a look at the following blog, which may be helpful
https://www.excelguru.ca/blog/2015/02/25/combine-multiple-excel-workbooks-in-power-query/
Later versions of Power Query automatically create a function to combine files excel files from folder.
Yury
Oct 25 2017 05:10 PM
SolutionHi 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 http://www.howtoexcel.org/power-query/how-to-import-all-files-in-a-folder-with-power-query (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.
Jun 13 2019 11:22 PM
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.
Oct 25 2017 05:10 PM
SolutionHi 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 http://www.howtoexcel.org/power-query/how-to-import-all-files-in-a-folder-with-power-query (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.