1

I'm trying to perform a query through an imported range, but whenever I have an empty cell in the first column, it gives me a cell that is a combination of ALL of the cells that have an empty Col1 at the top of the results that is a long list of all of the other results.

Here's the code:

=QUERY(importrange("https://dods.google.com/spreadsheets/d/(myurl)", "'Responses'!A2:Z"),"select Col2,Col1 where LOWER(Col2)='" & LOWER($B$1) & "' ORDER BY Col1")

Where $B$1 is the thing I am searching for. This code will give me all of the results but then also fills the top cell with ALL of the data from every empty cell in the imported sheet as well. How can I get it to stop adding that top result? I still want to get the results from cells that have an empty Col1.

1 Answer 1

2

Figured it out, adding a header of 0 to the query fixed it.

https://support.google.com/docs/answer/3093343?hl=en

QUERY(data, query, 0)
2
  • 4
    This does not work for me. I'm still seeing #N/A with the Error "Query completed with an empty output." It's possible to wrap the query inside of IFERROR(..., 0), but then you can't debug actual errors. It appears the Google documentation regarding the headers field is no longer accurate.
    – user24601
    Commented May 13, 2018 at 13:23
  • This is still true today. It's a shame that all languages for popular spreadsheets are so bad.
    – Ivan Perez
    Commented Sep 25, 2021 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.