Importing Excel Files from a Folder

khawarameer

Board Regular
Joined
Jun 2, 2009
Messages
152
Hello,

I am trying to import 05 excel files (.xlsx) from a folder in to power query. However when i use combined binaries it gives me error that said files are not in proper excel format. Further when it try to import individual file power query shows 3 sheets in the file where as i have made only one sheet in all these files with common name "Consolidated". can any one help however import all excel files.

Regards

KAM
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Instead of expanding, you can add a custom column that retrieves the content differently: Excel.Workbook([Content])
The reason why you're seeing more objects than sheets when opening the file is because Power Query identifies Excel-objects separately: If a table sits in a sheet, you Power Query would identify 2 objects: 1 sheet and one table. If there is a named range as well somewhere in the sheet, this would be shown as a separate object as well.
 
Upvote 0
Instead of expanding, you can add a custom column that retrieves the content differently: Excel.Workbook([Content])
The reason why you're seeing more objects than sheets when opening the file is because Power Query identifies Excel-objects separately: If a table sits in a sheet, you Power Query would identify 2 objects: 1 sheet and one table. If there is a named range as well somewhere in the sheet, this would be shown as a separate object as well.

Hello ImkeF,

This is the code that is giving me error can you guide me where should i add the custom column. The command you suggested is already in the code. Please Help.

Code:
let
    Source = Folder.Files("C:\Users\khawar\Desktop\TELLER_TR"),
    #"Combined Binaries" = Binary.Combine(Source[Content]),
    #"Imported Excel" = Excel.Workbook(#"Combined Binaries")
in
    #"Imported Excel"
 
Upvote 0
like this:

Code:
let
    Source = Folder.Files("C:\Users\khawar\Desktop\TELLER_TR"),
    #"Imported Excel" =Table.AddColumn(Source, "New", each Excel.Workbook([Content]))
in
    #"Imported Excel"
 
Last edited:
Upvote 0
like this:

Code:
let
    Source = Folder.Files("C:\Users\khawar\Desktop\TELLER_TR"),
    #"Imported Excel" =Table.AddColumn(Source, "New", each Excel.Workbook([Content]))
in
    #"Imported Excel"


Thanks ImkeF,

It worked fine.

Best Regards

KAM
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,220
Members
448,876
Latest member
Solitario

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top