0

What is the correct syntax for the URL (see also a related question about documentation) to view a Google Visualization API Query result as a web page containing the tabulated results of the query? "Directly" in the question subject line implies these constraints:

  1. From the URL only, and,
  2. Not requiring separate special web pages that read that Javascript output and reformulate it, and,
  3. Not requiring manual cut and paste operations, and
  4. Not requiring a bridge through a Google document that has to be created (since I want just a direct URL to render the page),

My failed attempt: My query is of the form (key value CENSORED):

http://spreadsheets.google.com/a/google.com/tq?key=CENSORED&tq=SELECT%20*%20WHERE%20lower(C)%20CONTAINS%20'something'

Browsing to that page dumps out the result as one long Javascript call containing JSON encoded info. Useful for programmers I bet, but not for direct viewing of a query result just by browsing to the query URL.

Tacking on a "&output=html":

http://spreadsheets.google.com/a/google.com/tq?key=CENSORED&tq=SELECT%20*%20WHERE%20lower(C)%20CONTAINS%20'something'&output=html

Does not change the output. Obviously "output=html" is not recognized or is ignored (guessing the syntax from Google Spreadsheets URL Syntax and Display Options?). This should be documented but I could not find it (hence another related question)

2
  • I recommend closing it as well: This one is likely not going to be answered anyhow, now that it is several months after I opened it. Besides, had I asked this on StackOverflow or PowerUsers, they probably would have migrated it to WebApplications anyhow.
    – bgoodr
    Jan 21, 2016 at 15:47
  • 1
    "had I asked" does not imply "it was asked" on those sites. I only asked it on this site. Regardless, we are in agreement that it should be closed.
    – bgoodr
    Jan 24, 2016 at 5:35

1 Answer 1

1

Try this: addition for html output in bold.

http://spreadsheets.google.com/a/google.com/tq?tqx=out:html&tq=key=CENSORED&tq=SELECT%20*%20WHERE%20lower(C)%20CONTAINS%20'something'

or the way google usually rearranges it:

http://docs.google.com/spreadsheets/d/CENSORED/tq?tqx=out:html&tq=key=CENSORED&tq=SELECT%20*%20WHERE%20lower(C)%20CONTAINS%20'something'

2
  • Almost. If you change "tq=key=" to just "key=" on both example URL's you gave, I verified that works.
    – bgoodr
    Jan 29, 2017 at 21:38
  • I also found that adding a "&gid=..." to the URL allowed me to chose a particular sheet within the spreadsheet as the target of the query. I found that I had to find the gid value to use by opening up the particular sheet in the Drive, and examining its value from the resulting URL (they were not 0-based from left to right, but were large integer numbers).
    – bgoodr
    Jan 29, 2017 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.