Forum

Importing from mult...
 
Notifications
Clear all

Importing from multiple folders, how to define folder as a field

5 Posts
2 Users
0 Reactions
61 Views
(@paulma)
Posts: 17
Eminent Member
Topic starter
 

Hi all, 

I am importing data from Excel files in a parent folder that has 3 child folders. When I import the data, I'd like to use the child folder names as a field in my imported data. What do I need to do, to achieve this? TIA, Paul

 
Posted : 01/02/2022 6:29 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Paul,

Using From File > From Folder and after you choose Transform Data normally you would click on the double down arrow on the content column to combine the files. Instead, you'll notice after clicking Transform Data you have the folder path (among other columns). To retain this, remove all columns except the Folder Path and Content columns, then add a custom column with this formula:

=Excel.Workbook([Content])

From here you can combine the files.

It's the same process as shown in lesson 3.03 of the Power Query course.

Mynda

 
Posted : 01/02/2022 6:48 pm
(@paulma)
Posts: 17
Eminent Member
Topic starter
 

Thanks Mynda, thanks for that. 

 
Posted : 03/02/2022 3:27 am
(@paulma)
Posts: 17
Eminent Member
Topic starter
 

Hi Mynda,

That lesson doesn't address my issue - it's looking at multiple sheets, I'm using multiple folders. Whenever I attempt your suggestion, I just get the original data, and no folder. What can you suggest? TIA, Paul

 
Posted : 04/02/2022 8:18 am
(@mynda)
Posts: 4761
Member Admin
 

I tested it on my PC. When you follow the steps in that video, one of the columns contains the file path. This file path contains the folder name. All you need to do is keep that column and extract the folder name.

 
Posted : 04/02/2022 8:02 pm
Share: