A long time back now, I showed how to publish and prettify source code and scriptdb contents using Google Apps Script. This allows you to embed code or data samples in blog posts and so on.
For example, below is the Google Apps Script code to do it, being shown live from the GAS IDE, using this link
ScriptDB as a non-Google Apps Script noSQL database
It can take a number of sources aside from Google Apps Script (such as gist, any url) and can return various formats, and select specific functions. One of the things it can do is to publish data inside a scriptDB. It occurred to me that with a minor tweak I could use it to query scriptDB (using the regular scriptDB query by example) and return JSON selected data to Excel, or any app that would know what to do with JSON – meaning that we’d have a ready made noSQL database.
For testing I’ll use the scriptDB in this example showing how to use multiple databases. I’ve created a merged database and embedded it using the link below
Query by example
It would be useful if we could selectively take results from that scriptDB. That would give us a noSQL database to be used as reference outside of Google Apps Script. Well – all I have to do is pass the JSON that describes the query I want to make, In this case I want all records for customer named john, so I can use scriptDB query by example language and pass it as a parameter
xliberation.com/p/gaspubcontainer.html is just a prettification wrapper for the Google Apps Script webapp that actually does the work. Below is that wrapper code (it’s being used to display itself)
So if you want to get this data, unadorned, into a web app you can simply call the underlying Google Apps Script directly giving it a type of ‘jsonp’ – adding a callback if you need one.
Here’s a live query below from a simple web app
and here’s the source code
For more stuff like this see Excel Liberation