Forum Discussion
MarkFlrz
1 year agoNew Member
Power Query Combine Multiple Files From Folder
Hi community, I'm working on combining 90 excel files from a folder. But the data combined from all files is compiling vertically and I need to change it so I can choose only the columns I need...
- 1 year ago
Hi,
No, you don’t need to add every file name.
You either keep only columns once in the combined query (applies to all files). Or, if need per-file logic filter on Source.Name patterns instead of listing every single file.Also instead of “Combine & Transform” you can also manually control it with a few lines of sample M code like below
let // Step 1: Load all files in the folder Source = Folder.Files("C:\YourFolderPath"), // Step 2: Filter only Excel files (if needed) ExcelFiles = Table.SelectRows(Source, each [Extension] = ".xlsx"), // Step 3: Extract tables/sheets from each file GetTables = List.Transform(ExcelFiles[Content], each Excel.Workbook(_, true)), // Step 4: Append everything together Combined = Table.Combine(GetTables), // Step 5: Keep only the columns you want Final = Table.SelectColumns(Combined, {"AddressID", "AddressLine1", "AddressLine2"}) in Final
v-prasare
Community Support
1 year agoWe would like to confirm if our community members answer resolves your query or if you need further help. If your query still not resolved can you please provide sample data as raisurrahman requested? this will help find solution easily.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support