Quiz App using google sheet via google's visualization API Query Language (instead of Data Source)

i’ve just recoded my earlier quiz app which used airtable as datasource into a new version using google sheet as source of the quiz but NOT as a data source. Instead i’m using Google’s Visualization API Query Language to read the worksheet (see this recent discussion in the forum ). It’s a different approach for working with google sheets, but i like it!

below is the contents of my worksheet. ( Note - in order to use the query language, the worksheet must first be shared such that anyone with the link can read it).

my quiz app starts with a list of tests to choose from.
these choices represent the distinct values of the column grp. if i had been using the worksheet as a data source i would have had to write my own drop-duplicates routine to obtain this list, but with the query language, i simply submitted this query
and i got the result as a json string, ready to parse.

later after my app gets the grp selected by the test taker, it will set up the quiz so only the rows with the matching grp will be presented. for example if the selected grp was ‘LY’, i would submit this query to the query language processor:
and ALL the rows matching the condition are returned in the json string response!

(note: the correct answer is always coded in answer1 but my app shuffles the possible answers at test taking time).

you can inspect the code to see how the queries are submitted and how the json reponses are parsed.
visit this link for the complete reference (it comes with its own urlencoder to help you formulate your query):

here’s my project link:


You nearly tricked me.

I was looking at your function runquiz and wondering how you got the special variable j to work outside of the original loop.

It took me some time to realize that it is a function parameter :rofl: :rofl:

1 Like


1 Like