Questions tagged [google-query-language]

Google Query Language is the part of the Google Visualization API that lets the developer perform various data manipulations with the query to the data source. This could also be used in the Google Sheets QUERY built-in function.

Google Query Language allow developers to perform various data manipulations using a syntax very similar to the SQL syntax. It's part of the and can be used in through the QUERY built-in function.

Before posting a question about the Google Query Language check the reference documentation.

1114 questions
143
votes
9 answers

Google SpreadSheet Query: Can I remove column header?

I'm doing this query at my google spreadsheet: =QUERY(H4:L35;"select sum(L) where H='First Week'"; -1) But it returns a little table with "sum" as header and result below it. What I want is just the result! How I remove header? Can I?
90
votes
6 answers

Google spreadsheet "=QUERY" join() equivalent function?

This question is concerning joining two databases in Google spreadsheet using =QUERY function I have a table like so in range A1:C3 a d g b e h c f i I have another table c j m a k n b l o I want the final table to look like this a d g k n b e h l…
jason
  • 3,811
  • 18
  • 92
  • 147
27
votes
2 answers

How do I filter view two columns OR instead of AND?

In Google Sheets, I want to filter view my results so only rows with an "x" in column D AND/OR column E are shown. If I filter to show the columns with an "x" in them, it will only show rows with an "x" in column D AND column E. How do I make it do…
26
votes
6 answers

Can the google spreadsheet 'query' function be used in google apps script?

I'm looking for a way to programmatically populate a spreadsheet that filters data from another spreadsheet based on the logged in user. I am able to do this using the query function inside a spreadsheet. BUT, unable to figure out a way to call the…
awsamar
  • 263
  • 1
  • 3
  • 6
20
votes
4 answers

SUMIFS function in Google Spreadsheet

I'm trying to have a similar function to SUMIFS (like SUMIF but with more than a single criterion) in a Google Spreadsheet. MS-Excel has this function built-in…
Guy
  • 12,388
  • 3
  • 45
  • 67
17
votes
4 answers

How can I escape an apostrophe inside a SQL query in Google Sheets?

Here's my function: =QUERY(QUERY(IMPORTRANGE("XXXXXXX", "XXXXXX!A1:C"),"SELECT * WHERE Col2 = 'Woman's blabla: blablabla'"),"SELECT Col1, Col2") I've tried adding another apostrophe: =QUERY(QUERY(IMPORTRANGE("XXXXXXX", "XXXXXX!A1:C"),"SELECT *…
16
votes
4 answers

Google Spreadsheets QUERY() to combine multiple sheets, same workbook

Goal: I'm using QUERY() in gSheets to combine data from multiple sheets in the same workbook. The data is an extract from GA broken down into small segments to prevent sampling. This means it has all the same fields, I'm just piecing it back…
Minadorae
  • 301
  • 3
  • 5
  • 13
14
votes
2 answers

Google Query - "NOT LIKE" Statement Doesn't work

The following line doesn't work: =QUERY(AB:AE,"select AB,AC,AD,AE where AB NOT LIKE '%Info%'",1) Throws: Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "AH "" at line 1, column 26. Was expecting one of:…
IdoS
  • 482
  • 1
  • 10
  • 18
13
votes
7 answers

Is there a way to insert blank columns in output with google sheets query?

Consider the query run from sheet2 =query(Sheet!A7:A, "Select A,B,C where A='Order'") but I want to put this in columns A,E,F in Sheet2. I've found the workaround =query(Sheet!A7:A, "Select A,X,Y,Z,B,C where A='Order'") Where XYZ are blank…
Sherwood Botsford
  • 1,889
  • 5
  • 20
  • 35
11
votes
1 answer

Google Sheets Queries and 'not in'

I am trying to piece together a query that does a few things. One, I want it to list out all the names in a column, and two, I only want it to list out the name from that column if it doesn't exist within an array of columns. …
9
votes
2 answers

Google Sheets - Query Multiple Columns With Custom Labels

I am trying to create a simple query in my Google Sheet that will allow me to label the two columns it is outputting and sort the results based off of another column. However as soon as I add the Order By or the second Label command it throws and…
user10012
  • 647
  • 1
  • 8
  • 23
9
votes
1 answer

Google Sheet Query - Group / concatenate multiple rows

I'm running a QUERY with a SUM and GROUP BY, but I'd like to aggregate multiple distinct values from the rows into a single row and column. I'm looking to concatenate all those values together. Current…
Tom
  • 1,051
  • 4
  • 21
  • 36
8
votes
2 answers

ImportRange Function to Ignore Empty Cells

I want to import a range from another Google sheet, but to ignore empty cells so that the data prints back to back (versus having big gaps created from importing empty cells). Here is my formula (Google link changed for…
7
votes
2 answers

Convert blank values to zero when using the Query function

Is there a way to convert data going into a query() function so that blank/null values are converted to zero? I have a dataset with three columns: Group AC Plan Comms 350 [blank] IT 50,000 85,000 Rent 15,000 …
7
votes
2 answers

Google Query Language Concatenation

Is it possible to concatenate the value from a column with a string in Google Query Language? I'd like to do something like this: =QUERY('Business Income'!A1:E, "select 'Q' + quarter(A), sum(B) where A is not null group by 'Q' + quarter(A) label…
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
1
2 3
74 75