(Google Sheets) Query and return multiple tables from url

I am using JSON data from google spreadsheet, for 2 mobile apps (iOS and Android). The same information can be output using HTML or XML, in which case I am using HTML, so the displayed information (from the spreadsheet) can be understood by everyone. The only logical way to do this is without authentication (OAuth) via public URLs. Information on what Im talk can be found here . To understand what I am asking you have to actually click the links and see for yourself. I don't know how to "call" some of the things I ask, since the google documentation is not bad, not my fault.

In my application I have a search function that queries a spreadsheet (USING A QUERY URL) by rows of this,

https://docs.google.com/spreadsheets/d/1yyHaR2wihF8gLf40k1jrPfzTZ9uKWJKRmFSB519X8Bc/gviz/tq?tqx=out:html&tq=select+A, B, C, D, E +, where + (B + contains GID = 0

I select my columns (A, B, C, D, and, E) and ask (Google) that only rows where column B contains the word cat should be returned. Again, I stress that this is done with a URL (entering the correct term). I CAN'T use almost any function / formulas that would normally work in a spreadsheet, like ArrayFormula or ImportRange. I actually only have access to 10 language suggestions (read the link first). I have pretty good knowledge of tables and databases, and since the URL method of getting information from them is similar, they have nothing to do with the same.

Now I would like to include this part in the url

tq?tqx=out:html&tq=select+A,B,C,D,E+where+(B+contains"Cat")&gid=0

      

Output type, HTML in this case

tqx=out:html

      

Start request

&tq=

      

Select columns AE

select+A,B,C,D,E

      

To return specific information about Cat

where+(B+contains"Cat")

      

This is probably the most important part of my question. This is used to indicate which table (Tab) is being requested.

&gid=0

      

If gid is changed from gid = 0 to gid = 181437435, data is returned from the second spreadsheet table. Instead of doing 2 queries to look up both tables, is there a way to do both in one query? (eg union 2) <- THIS IS WHAT TO WATCH IM.

There is an AND clause I tried all over the url

select+A,B,C,D,E+where+(B+contains%20"Cat")&gid=181437435+AND+select+A,B,C,D,E+where+(B+contains%20"Cat")&gid=0

      

I even flipped gid

around and put in other places, but only the last (gid) in the url seems to be, and no matter what is done, only one table is returned. By the way, grouping is allowed. If that doesn't clear my question, then let me know where you lost. Also, I would post more urls for easy access, but I'm kind of in this program with two urls.

+3


source to share


1 answer


If I understand your requirement, indeed, with syntax like this, for example:

=ArrayFormula(QUERY({Sheet1!A1:C4;Sheet2!B1:D4},"select * order by Col1 desc"))

      

;

stacks one array on top of another ( ,

for side-by-side).



My bewilderment has to do with the "URL Query Language" as it is called Google Query Language (there is even a tag , although IMO almost all of these Qs belong to Web Applications - including this one in my opinion!) Is not limited to using URLs.

In the example above, the sheet references can be replaced with data import functions.

+1


source







All Articles