Yes, it is possible with a construct like so:
=IMPORTRANGE("key";"Foglio1!A2:B2")
and, in New Google sheets, allow permission for the linking. key
above is the spreadsheet key (long upper/lower case alphanumeric between forward slashes visible in the URL for the source sheet). Though you can use the entire URL.
You probably want 1 instead of 16 as the last parameter of the query; this parameter means the number of header rows, not of headers.
You also have an extra pair of parentheses in your formula. Otherwise the formula is correct (tested in my spreadsheet), although you could shorten it by replacing select Col1,Col2,..., Col16
with select *
=QUERY(IMPORTRANGE("URL","Sheet Name!A2:P1000"),"SELECT * WHERE Col6 CONTAINS 'Abstract & TO'",1)
A possible source of your errors is that your spreadsheets are not connected for the purpose of IMPORTRANGE
:
In the new version of Google Sheets, spreadsheets must be explicitly granted permission to pull data from other spreadsheets using IMPORTRANGE
. The first time the destination sheet pulls data from a new source sheet, the user will be prompted to grant permission.
Unfortunately, you will not see this prompt if your IMPORTRANGE
command is within a QUERY
; the parse error is thrown instead as there is nothing for QUERY
to parse. To connect the spreadsheet, import something first, e.g.,
=IMPORTRANGE("URL","Sheet Name!A1")
You will see #REF
error; hovering over it shows an explanation and "connect" button.
Best Answer
You've created a virtual array within the curly brackets but not "prepped" the formula for that. Try wrapping the entire thing in
ArrayFormula(...)
:=ArrayFormula(QUERY({IMPORTRANGE(L2 ,"sheet1!A2:F20");IMPORTRANGE(L3 ,"sheet2!A2:F20")},"select * where Col1 is not null"))