I'm trying to import data from multiple spreedsheet to one using query,
=QUERY({IMPORTRANGE("1wMGl6qkQuz5ux42u4w8YAIEGiB3SN2b4EcgVJI-RTx4","DELIVERY DETAIL!$A$3:$I");
IMPORTRANGE("1A2dgmXRWbCzc9_jH38WruOMALsXrq8RFx7BcDW9Z8EI","DELIVERY DETAIL!$A$3:$I") },
"SELECT Col1,Col8,Col9 ",0)
the problem for me i get the data from one spreedsheet and receive nothing from the 2nd one,(i tried both of the importrange seperately without the query and it's working good), and it's importing the data from the source but when both of the importrange work it bring just data from 1st spreedsheet
BTW the name of the tabs are the same as i made duplicate the same spreedsheet
you did not filter out empty rows. try:
=QUERY({
IMPORTRANGE("1wMGl6qkQuz5ux42u4w8YAIEGiB3SN2b4EcgVJI-RTx4","DELIVERY DETAIL!$A$3:$I");
IMPORTRANGE("1A2dgmXRWbCzc9_jH38WruOMALsXrq8RFx7BcDW9Z8EI","DELIVERY DETAIL!$A$3:$I")},
"select Col1,Col8,Col9
where Col1 is not null", 0)
Related
I am importing data from two different Google sheets and merging them in another sheet. The formula which I used is as below .
=QUERY({
IFERROR(QUERY(
{ IMPORTRANGE("" , "Sheet1!$A$1:$b") },
"SELECT Col1,Col2 WHERE Col2='Total'",
0
)) ;
IFERROR(QUERY(
{ IMPORTRANGE("" , "Sheet1!$a$1:$b") },
"SELECT Col1,Col2 WHERE Col2='Yes'",
0
))
})
In above formula, importrange is giving the result when both sheets have data to import, but if any one sheet has no data to import the data from another sheet is not getting imported. I had figured a solution at below link where we can handle this issue by using dummy column reference, this approach is fine when we have few sheets to import with few columns but when we are importing from many sheets and many column to import the dummy column reference gets too long. Is there any other way to solve this issue.
The easiest way to do this is to use an IFERROR(SEQUENCE(1,n)/0) as your output for when a query of an importrange fails instead of needing to list a bunch of blanks.
The solution for your simple example looks like this where n = 2:
=ARRAYFORMULA(QUERY({IFERROR(QUERY({IMPORTRANGE("1hea986JF3plR_tn7plNRgjWhiGqxOlR8s8yE-Ri6FfU" , "Sheet1!$A$1:$b")}, "SELECT Col1,Col2 WHERE Col2='Total'",0),IFERROR(SEQUENCE(1,2)/0));IFERROR(QUERY({IMPORTRANGE("1IbPpoLLfa-ukoz2WInlgNGSNMNBxBwSx4in52fZCEyE" , "Sheet1!$a$1:$b")},"SELECT Col1,Col2 WHERE Col2='Yes'",0),IFERROR(SEQUENCE(1,2)/0))},"where Col1 is not null"))
I am not sure why this functionality stopped working, but I am sure it has to do with inconsistent back end data or how the query condition "CONTAINS" needs to be changed. The IMPORTRANGE portion works just fine, but will not always pull data into the front end sheet. The query portion looks like this
SELECT Col3, Col2, Col1 WHERE Col2 CONTAINS "&'Job Number'!A1&" ORDER BY Col3 ASC,1
Column 2 contains job numbers that are xxxxx with another 3 digit code appended to end of it. It will only populate temporarily if I manually go into the sheet and edit the IMPORTRANGE range values. If I close the spreadsheet and open it again it will not populate. Does the data in Column 2 need to be a consistent datatype throughout the column or it will break the query?
Unfortunately we do not have a test sheet, so we can not know what the expected results would be.
Nevertheless, your formula syntax is not correct.
The correct syntax would be:
SELECT Col3, Col2, Col1 WHERE Col2 CONTAINS '"&"JOB"&A1&"' ORDER BY Col3 ASC,1
Please notice the syntax '"&"JOB"&A1&"'
(If you still have issues please share a test sheet and let us know.)
The full google spread sheet system is used for score keeping and is prone to delays when updating, however I have never run into an issue like this were the same basic function is returning two separate results. The problem is repeatable and occurs on more than one spreadsheet.
I have created a test sheet-
https://docs.google.com/spreadsheets/d/1arh0D9ch5MpQjRh_bHjLfLx5S7TAW8R_pgGLf5tovig/
with the code in question; Can anyone help please?
=QUERY(IMPORTRANGE("***","***"),"select Col1 where Col1 <>5 order by Col9 desc")
in your QUERY formula you are selecting cells that are numeric and comparing it to <>5 but take a notice that A2 is not numeric:
that is the reason why 2 2 is not included in your C column
also it looks like that your QUERY formula smashed first cells into one because you did not specify the 3td query parameter. try:
=QUERY(IMPORTRANGE("1pnowvo6YVj-DZAPCaKE2x9vSIbpAAmlwhRMO2OZNlrE","color!A84:M115"),
"select Col1 where Col1 <>5 order by Col9 desc", 0)
I have multiple google sheets (45 of them, all dynamic, its content will keep on changing) and I want to combine data of all of them into a single file. I was hoping to use some importrange or QUERY function so that moment one / any file is updated, the changes reflect automatically on the combined sheet.
Example book 1 :
https://docs.google.com/spreadsheets/d/1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI/edit?usp=sharing
Example book 2 :
https://docs.google.com/spreadsheets/d/1jZml9oVI2Flma407AB4ndl_ZIsQ_5I8zhkzvbL_EO_g/edit?usp=sharing
Example combined book :
https://docs.google.com/spreadsheets/d/1LkiIY1aUmwaouR7f4KhaGs6MV365KY7DYUPMiTzxjvc/edit?usp=sharing
first you need to connect them by pasting each IMPORTRANGE formula in some cell to get #REF! error
then hover over that #REF! error with your cursor and a secret magic button will popup
click on it to allow access
then you can stack up all import ranges and wrap them in a query:
=QUERY(
{IMPORTRANGE("ID1-or-URL1", "Sheet1!A1:A");
IMPORTRANGE("ID2-or-URL2", "Sheet1!A1:A");
IMPORTRANGE("ID3-or-URL3", "Sheet1!A1:A");
IMPORTRANGE("ID4-or-URL4", "Sheet1!A1:A")},
"where Col1 is not null"), 0)
update:
={ IMPORTRANGE("1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI", "Sheet1!A1:N2");
QUERY({IMPORTRANGE("1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI", "Sheet1!A3:N" );
IMPORTRANGE("19SFnJab9xVW2SenK-8IuG2cQRT2exJeyqARjTdDE_R8", "Sheet1!A3:N" )},
"where Col1 is not null", 0)}
Another problem with Google Spreadsheet API. I'm trying to use QUERY() function in order to get all customers from our database who are from Warsaw. Google API seems however to have a big problem with parsing my query. I've checked it few times and everything is OK. Tried semicolons, different apostrophes and column names—it still won't work. I type this code in the sheet cell:
=QUERY(IMPORTRANGE("0ArsOaWajjzv9dEdGTUZCWFc1NnFva05uWkxETVF6Q0E"; "Kuchnia polska!A3:G40"); "select B where E contains 'Warszawa'")
And get error like this:
Invalid query: Column [E] does not exist in table.
And I'm 110% sure that the column exists and the spreadsheet key is OK. ;)
If you are using the Query function with a direct reference to a rectangle of cells, then you use capital letters to refer to the columns. However, if you are using Query against the output of an array formula, such as the return from ImportRange, then you instead need to use Col1, Col2, ... to refer to the columns. So, your example query string would need to read:
"select Col2 where Col5 contains 'Warszawa'"
Working example:
=Query(ImportRange("0AtEH2Kw9zfIodEQ2dFNFam9sdEFEZlVnNEV3ZEZMZEE", "data!A:G"), "select Col3, count(Col4) group by Col3 order by count(Col4) desc label count(Col4) 'count'")
I've no idea why it doesn't just let you use names from a header row.
Alternatively you can try the FILTER function in this case and then you don't need to bother with SQL. :)
=FILTER(ImportRange("0ArsOaWajjzv9dEdGTUZCWFc1NnFva05uWkxETVF6Q0E"; "Kuchnia polska!B3:B40"); ImportRange("0ArsOaWajjzv9dEdGTUZCWFc1NnFva05uWkxETVF6Q0E"; "Kuchnia polska!e3:e40")="Warszava")
Although I admit that it's not so pretty because of the two importRange functions.
Hope it helped anyway.