You will need a script to host the scriptdb that contains your public data. In the step by step guide, Delegation to Google Apps Script, you should have created a script, pubstuff and added the mcpher library. Here’s the code you need, you can just paste this in unchanged.

/** @description
 * using scrpt DB as a repository for public stuff - accessible through a rest call
 * @author <a href="">Bruce McPherson</a><a href=""></a>

 * return the stuff from the db associated with the e.parameter.entry value or execute a proxy URL using lockbox for oAuth
 * @param {object} e the event parameters
 * @return {String} the rest response
function doGet(e) {
       return ContentService
            .createTextOutput(mcpher.getPubStuffContent (e,publicStuffDb()))
            .setMimeType(ContentService.MimeType.JSON); ;     

 * myStuffDb return the shared DB for myStuff
 * @return {ScriptDbInstance} the db
function publicStuffDb() { 
  return ScriptDb.getMyDb();

function testPublicStuff(){
  Logger.log ( mcpher.getPubStuffContent(  { parameter: null}, publicStuffDb() ) );


  • publicStuffDb is the function that will provide access to your public scriptdb, and will be used by other scripts. 
  • doGet(e) will expect the optional parameter ?entry=[name]. If no name is specified then the entire shared scriptDB will be shown.
  • ContentService is used to serve up a jSon representation of the data in the scriptDB


I always try to keep the data in a doGet() function to a minimum. This means that I can test the whole thing before publishing it. The function testPublicStuff () will log the contents of the scriptDB so you can check before publishing.  If you look at the log, you should see this, since we haven’t yet put anything in the scriptdb

{"status":{"code":"bad","reason":"null has no data"},"results":null}


This is going to be a public script, available to all, so we are are going to make it publicly accessible and publish it with anonymous access. Here’s how
First authorize doGet() by running it. You’ll get this message. You only have to do this once.

Go to manage version

and save this version

Now we can publish this as a web application.


and make it accessible publicly, even anonymous

Now take a note of  the url of your published app. My version of this example is

Copy the URL to a browser. You should get the same result as you did while testing. 

{"status":{"code":"bad","reason":"null has no data"},"results":null}

Project properties

You are going to need the project properties of the script you have just created so you can include it as a library in other scripts that need to access this scriptdb. Take note of your own key from the project properties.  Here’s mine below.

Now take a look at the next step in step by step guide to delegating to Google Apps Script.