Document 1 has many rows of data.
How do I import into document 2 only those rows that have a certain value in column C?
Web Applications Stack Exchange is a question and answer site for power users of web applications. It only takes a minute to sign up.Sign up to join this community
This is not as straight forward as a normal import using the
IMPORT function. With this function, you are able to perform imports only:
Adding a function, like
FILTER, within the "range" string will result in an error. The solution must be found, by using the
=QUERY(IMPORTRANGE("key","range"),"SELECT * WHERE Col1='value'")
=QUERY(IMPORTRANGE("key","A:Z"),"SELECT * WHERE Col1 contains 'value'")
After WHERE, Column definition must be as first letter upper-case then lower case. Col will work, COL or col will not.
Once imported you can order the results by using the
ORDER BY clause:
=QUERY(IMPORTRANGE("key","A:Z"),"SELECT * WHERE Col1 contains 'value' ORDER BY Col1")
IMPORTRANGE function cannot do selected columns, it can only do one range block. The way around this is to use the
=QUERY(IMPORTRANGE("key","A:Z"),"SELECT Col1, Col2, Col3 WHERE Col1 contains 'value' ORDER BY Col1")
Had this same issue: This is what I ended up using.
=iferror(QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/[YOUR_KEY_FROM_URL]/edit","Title of Sheet You are Using!A2:I42"),"select * WHERE Col5 CONTAINS 'Towel'",1),"no values yet!")
Lets break it down a bit
IFERROR allows you to display a user friendly message if this fail because no data is returned
QUERY allows you to specify the search criteria. You can omit this if you simply want to import the range of cell regardless.
IMPORTRANGE Use the url provided, then fetch this sheet, looking at these ranges (top left, to bottom right)