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

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
765
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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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