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



## countryfan_nt (Sep 2, 2018)

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.



```
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$]
```


----------



## Fazza (Sep 3, 2018)

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??


----------



## RoryA (Sep 3, 2018)

Do you not have Power Query available?


----------



## countryfan_nt (Sep 4, 2018)

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!


----------

