google-sheets-query

QUERY using cell contents as SQL variables

蹲街弑〆低调 提交于 2019-12-03 10:00:55
Here is what the spreadsheet I'm working with looks like: Summary table (top of sheet) Source data (same sheet, below output) I'm using the QUERY function to populate the appropriate feeds in the summary table with the data starting at A24 needs to be placed into. Here is the formula I'm using in cell C6 (similar formulas are used throughout the summary table): =QUERY($A$24:$D$57, "Select D Where B='ENQ' and A='2/27/14 - Thu'") This gets the right information, but the formula needs to be edited to be unique in each cell it's used in. The problem being unable to quickly populate the cells with

Looping through a set of google sheet values

女生的网名这么多〃 提交于 2019-12-02 13:42:53
I have 2 sets of data. One is tank names Tank Name A1 A2 B1 B2 and the next is ON/OFF Data ON/OFF 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 Now the result I am looking is, when the ON/OFF is 1 then the first tank is to be mentioned: when it's 0, no tank to be mentioned. Once all the tanks are mentioned,then it should again start from the first tank ie A1.But if 0 comes in between then it should start again from A1 .. like this Result expected 0 1 A1 1 A2 1 B1 1 B2 1 A1 0 0 1 A1 1 A2 1 B1 1 B2 1 A1 1 A2 1 B1 0 0 1 A1 1 A2 1 B1 0 1 A1 1 A2 You can check the google sheet here : Scenario 2

Query one table and output data into multiple columns

柔情痞子 提交于 2019-12-02 04:57:56
Simply put I am trying to take a single column query result and output it into a 5 wide by × long table. This is how the main table is organized. On separate tabs, I want to list all of the caught and seen Pokemon on their own for easy search. While I can get it to output something like this with =query(NatDex, "Select C Where F <> ''",1) I would like it to output the data something like this for easy reading so it's not eventually 100+ entries long: Bonus points if you can give me formula/something to do it where I can vary how wide the second table is. But this is far less important to me. I

Getting the count and unique values of a column of comma separated values?

[亡魂溺海] 提交于 2019-11-30 14:40:21
Supposing all I have is the column A below + + A | B | C +--------------|---------|----------+ | | X, Y, Z | X | 3 | | X, Z | Y | 2 | | X, Y | Z | 2 + + How do I generate columns B and C - where the B column grabs the unique elements from A, and the C column generates a count of those values. =ArrayFormula(QUERY(TRANSPOSE(SPLIT(JOIN(",",A:A),",")&{"";""}),"select Col1, count(Col2) group by Col1 label count(Col2) ''",0)) QUERY function TRANSPOSE function SPLIT function JOIN function Without hidden cells is possible to do it with an alternative method than the one proposed by Adam (that did not

Google SpreadSheet Query: Can I remove column header?

折月煮酒 提交于 2019-11-29 20:32:38
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? Try this: =QUERY(H4:L35,"select sum(L) where H='First Week' label sum(L) ''") Hope that Helps! user280150 =QUERY(QUERY(A1:D, "SELECT *", 1), "SELECT * OFFSET 1", 0) The outer query: "SELECT * OFFSET 1" excludes the first row (the header). The inner query explicitly specifies one row of headers (via the third argument supplied to QUERY ), whilst the outer query

Using Bound Google Scripts to Generate a Query Object

我的未来我决定 提交于 2019-11-27 15:25:39
I am using a Google Script bound to a Google Sheet to programatically generate the following query: =query('16 Jul - 20 Jul Responses'!A1:I31, "SELECT C WHERE D = 'Available'", 0) Is there any way in Google Scripts to parse an object representation of that query's results? I'd like to be able to code something like: var queryString = '=query('16 Jul - 20 Jul Responses'!A1:I31, "SELECT C WHERE D = 'Available'", 0)'; var results = new Query(queryString); for(var i = 0; i < results.length; i++) { var result = results[i]; // do something } As far as I can tell, the Query object doesn't exist

Google spreadsheet Query Error - column doesn't exist

醉酒当歌 提交于 2019-11-27 14:47:02
问题 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

Escape column name in query (to avoid conflict with reserved words)

大城市里の小女人 提交于 2019-11-27 08:40:27
问题 I have a Google Sheets and want to query in a column called BY . This is failing: =query(Data!A:GC, "select BY where BG = 'completed'") How can I escape that BY column name? 回答1: Please try backquotes - eg: =query(Data!A:GC, "select `BY` where BG = 'completed'") 回答2: so to use the column BY as an identifier you must use backquotes around it... `BY` CREDIT: JAMES @ https://productforums.google.com/forum/#!msg/docs/tFB_02gNceQ/-2IUvmnQBgAJ 来源: https://stackoverflow.com/questions/28048788/escape

Using Bound Google Scripts to Generate a Query Object

风格不统一 提交于 2019-11-26 12:31:44
问题 I am using a Google Script bound to a Google Sheet to programatically generate the following query: =query(\'16 Jul - 20 Jul Responses\'!A1:I31, \"SELECT C WHERE D = \'Available\'\", 0) Is there any way in Google Scripts to parse an object representation of that query\'s results? I\'d like to be able to code something like: var queryString = \'=query(\'16 Jul - 20 Jul Responses\'!A1:I31, \"SELECT C WHERE D = \'Available\'\", 0)\'; var results = new Query(queryString); for(var i = 0; i <