Skip to main content
Cadet | Tier 2
March 22, 2022
Question

I have a SQL query issue

  • March 22, 2022
  • 2 replies
  • 454 views

I have a SQL query to read the data from excel, and using the select query like below

SELECT DISTINCT [F1],SUM([F6]) FROM [Sheet1$A2:G] GROUP BY [F1]

but there is no data in sheet1 hence it is showing the error like 'This table contains cells that are outside the range of cells defined in the spreadsheet'. can anyone help me with this

 

    2 replies

    Ashwin A.K
    Navigator | Tier 3
    March 22, 2022

    Hi @Shilpa N​ ,

     

    I don't think passing in a range will do you much good.

    Even if you are using SQL, it is limited to microsoft Access , and even more so when working with Excel.

     

    Try passing the entire sheet name instead:

     

    SELECT DISTINCT [F1],SUM([F6]) FROM [Sheet1$] GROUP BY [F1] ->If v11

     

    SELECT DISTINCT [F1],SUM([F6]) FROM [Sheet1$$] GROUP BY [F1] -> If A360

     

    Kind Regards,

    Ashwin A.K

     

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Shilpa.N3Author
    Cadet | Tier 2
    March 23, 2022

    Thanks Ashwin,

     

    let me try this solution.