Importing multiple files with SQL UNION ALL works for only 2 files. No column detected error on 3rd file.

hairycoo

New Member
Joined
Nov 12, 2012
Messages
6
I'm trying to import multiple xlsx files (identical structure) according to this tutorial which is referenced in so many posts here: contextures.com/PowerPivot-Identical-Excel-Files.html
It works beautifully for 2 files but the moment I add a 2nd UNION ALL statement I get a "No column detected" error.
This works:

SELECT ['mychoice-final-b9BwZvd@month da$'].* FROM ['mychoice-final-b9BwZvd@month da$']
UNION ALL
SELECT * FROM `D:\mark.xlsx`.[mark$]

This works:

SELECT ['mychoice-final-b9BwZvd@month da$'].* FROM ['mychoice-final-b9BwZvd@month da$']
UNION ALL
SELECT * FROM `D:\john.xlsx`.[john$]

This doesn't:


SELECT ['mychoice-final-b9BwZvd@month da$'].* FROM ['mychoice-final-b9BwZvd@month da$']
UNION ALL
SELECT * FROM `D:\mark.xlsx`.[mark$]
UNION ALL
SELECT * FROM `D:\john.xlsx`.[john$]

It's driving me crazy! I just don't understand why it doesn't work. I've looked up UNION ALL syntax and read every single post I could find, I've triple checked the table names too, the structure is identical. The latter results in a "no column detected". Can anyone help?

UPDATE:

I think the problem is the number of columns in my Excel files (I have 124 columns). I have deleted them (different types, numerical and digits) and it seems that once my document has more than 85 columns I get the above error. I tried it with the EastCoast sample files in the tutorial. If the document has 85 columns or less I can add as many files using UNION ALL. If it's over 85 columns it hits a brick wall!
Has anyone encountered this problem? Can anyone offer a workaround?
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,223,933
Messages
6,175,473
Members
452,646
Latest member
tudou

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