PowerPivot: SQL statement is not valid. There are no columns detected in the statement.

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
758
Hello friends, Hope All is well! Going crazy!

I keep getting the error msg: SQL statement is not valid. There are no columns detected in the statement.
the idea is borrowed from: https://www.contextures.com/PowerPivot-Identical-Excel-Files.html

it is to add data from a workbook (4 sheets) to an existing workbook. compiling rows on top of eachother.

The code below won't work. please help me fix it. Thank you in Advance.


Code:
SELECT [JAN-APR$].*   FROM [JAN-APR$]

UNION ALL 
SELECT * FROM `F:\DATABASES\AvgClaimCo\15.xlsb`.[Jan-Mar$]

UNION ALL 
SELECT * FROM `F:\DATABASES\AvgClaimCo\15.xlsb`.[Apr-Jun$]

UNION ALL 
SELECT * FROM `F:\DATABASES\AvgClaimCo\15.xlsb`.[Jul-Sep$]

UNION ALL 
SELECT * FROM `F:\DATABASES\AvgClaimCo\15.xlsb`.[Oct-Dec$]
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
suggest you confirm the source data is as expected.

then query each worksheet individually to see they each work.

that is, one query just with : SELECT [JAN-APR$].* FROM [JAN-APR$]
then one query just with :
SELECT * FROM [Jan-Mar$]
etc

The first one is different from the others, BTW. It is not a normal quarter, such as Jan-Mar. But is Jan-Apr. Is that what you want??
 
Upvote 0
Greetings, thanks to all of you and the help that you provided. I discovered what the problem is. it seems that there were extra columns with data in 15.xlsb, so not all the columns were identical.
as a result, the error occurred. I deleted the extra columns to get a match when compared with other columns from other sheets. All good now. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

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