February 1, 2019
o wow very nice approach,
thank you!
Hmm ok but when i have to select multiple files like Test1 - like for example 50 from folder i would have to do one big transformation i think.
Using Merging columns and unpivoting them, can you help also with that?
And furthermore, how can i add workbook source name to colum? (i would to take without extension = "xlsx").
I attached second worbkook - i need one more column here - workbook name.
Best Wishes,
Jacek
July 16, 2010
Ah, not all of the information was provided with your first question. I suspect there is more you haven't explained, like;
1. will each file in the folder have the exact same structure (columns, rows, sheets)?
2. will the data be formatted in Excel tables or named ranges, or just random unspecified ranges as per your first example file, in which case, how will Power Query know which cells you want to consolidate and which you want to exclude?
3. will each file also have data that is redundant as there was in your example file in the first few columns?
4. will each file have only one sheet containing data you want to get?
The second sample file, PQTEST.xlsx connects to external files that I don't have, therefore I cannot see the query or data. Please provide the source files as well.
Mynda
February 1, 2019
Hi Mynda,
thanks for questions!
1. Yes, exact structure
2. There is no tables and ranges. PQ will use Columns without structure
3. Yes, the structure is the same and everywhere i have to take only specific columns
4. yes, only one sheet.
External files in attachment.
In PQTEST.xlsx i am just trying to merge Test1 and Test2 from the same folder.
July 16, 2010
Thanks for providing the sample files. You'll see in the attached I used Get Files from Folder and that you need to duplicate the final query two more times so you have 3 queries, one for each table in the files; UpdatedName, NameAdded and NameDeleted.
The file name is automatically retained when you get files from a folder, so nothing extra to do there.
Mynda
February 1, 2019
o wow thank you very much!
Few questions:
1. = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true) and action "Filtered hidden files".
How did you do this?
2. When you were creating 4 queries : "NameAdded", "NameDeleted" you wre copying queries manually and deleted other files created with them together?
(not necessery one)
Best,
Jacek
July 16, 2010
1. This is done by Power Query automatically when you get files from a folder.
2. The first query under the 'Other Queries' folder is created automatically when you get the files from a folder. I renamed it, then duplicated it two more times for the NameDeleted and UpdatedName queries. Then deleted the columns from each query that weren't relevant.
Answers Post
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
You can create a table with a single row that contains your folder path.
In power query, add a new line using Advanced Editor with:
FolderName = Excel.CurrentWorkbook(){[Name="Table1Name"]}[Content]{0}[Column Name],
Rplace the hardt yped path from the query with this parameter name:
Source=Folder.Files(FolderName)
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Hi Jacek,
As mentioned, the cell that holds the path should be in a Table, not a regular cell.
Select L1:L2 and press Ctrl+T to create a table.
In the attached file, the table name is Table2, use it in query:
FolderName = Excel.CurrentWorkbook(){[Name="Table2"]}[Content]{0}[FolderPath],
Source=Folder.Files(FolderName)
1 Guest(s)