I am trying to do the following:
- Bring information to a google sheet from another google sheet using importrange.
- I need the information of two columns, but bases on the criteria of a third column I do not need to display.
This is what I tried to do:
Script
=query(importrange("Link1","Sheet!b1:h"),"SELECT G, H where B = "Criteria_to_meet"",-1)
It does not work.
Any advice?
CodePudding user response:
Since the query is loading data via importrange, you need to use the other select notation, Col1,Col2
rather than A,B
.
Hence, instead of select G,H where B
you would use select Col7,Col8 where Col2
.
In addition, "Criteria_to_meet"
would most likely need to be ""Criteria_to_meet""
(double quotes x 2) or 'Criteria_to_meet'
(single quotes).
CodePudding user response:
Thanks for your help. Your comments were very usesful. This is how it finally worked.
Cell A1 contains criteria_to_meet, and we expanded the import range to contain the first column.
###Formula =QUERY(importrange("Link1","Sheet!A1:H"),CONCATENAR("SELECT Col7, Col8 WHERE Col2='",A1,"'"),1)