1

A1 cell has 1. And I try use value from this cell through:

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxxxxx/edit?usp=sharing"; "Sheet1!A:P");       
     "select * where Col1='"&A1&"'"; -1 )

But I can't use information from A1 cell. I have nothing result. But, if I change code Col1='"&A1&"' to Col1=1 it works.

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxxxxx/edit?usp=sharing"; "Sheet1!A:P");       
         "select * where Col1=1"; -1 )

But I need that query function use value from A1 cell. How to do this?

0
1

In the query we only use single quotes when the value is text like klm

"where Col1=' "&A1&" ' "

With numbers we do NOT use single quotes.
It looks like the value in your A1 cell is the number 1
So your query should be

"where Col1="&A1&" "
1
  • Thank you for taking the time to accept. Please remember that you can even upvote the answer. If you don't have enough reputation, your upvote will show up later, once you reach enough reputation points. – marikamitsos Feb 2 at 19:24
0

The problem occurs because your formula sets the third parameter as -1 which means that the column headers should be guessed. Remove this parameter or set it to 0, but, there is a simpler way to get the value of A1:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxxxxx/edit?usp=sharing"; "Sheet1!A1")
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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