Google Apps Script Liberation – publishing your stuff

Usually on this blog and the associated site I cover topics to do with getting data in an out of Excel. Lately though, I’ve been playing around with using Google Apps Script as a proxy and publishing data out of Google Apps Scripts.

I’ve brought many of those concepts together to create a single publisher to expose your scripts, scriptdb data and other public content in a variety of formats such as standalone web page, a js function that returns the html code for a page, as json data and as jsonp data. I’ve also included a code prettifier and json beautifier in the code.
The main purpose of this is to be able to publish your code snippets or scriptdb data as dynamic content in iFrames in other web sites, or to get the content as Json data. However, same domain restrictions on iFrames and jSon make this hard to achieve. The js and jsonp options mitigate these issues allowing you to embed source code in a variety of hosts. Here is how it fits together.
And here is an example of embedding some source code (in this case the library code to do this) in this blog using an iFrame with this code.
<iframe height="400"
 src=”http://dl.dropbox.com/u/14196218/Share/gaspubcontainer.html?library=mcpher&module=gasPub” width=”100%”>

Your browser does not support iframes.

http://dl.dropbox.com/u/14196218/Share/gaspubcontainer.html?library=mcpher&module=gasPub

Similarily you can include data from a scriptDB with code like this where you need it in your blog

<iframe height="400" 
src=””http://dl.dropbox.com/u/14196218/Share/gaspubcontainer.html?library=pubstuff&module=favorites&source=scriptdb” width=”100%”>

Your browser does not support iframes.



http://dl.dropbox.com/u/14196218/Share/gaspubcontainer.html?library=pubstuff&module=favorites&source=scriptdb For how to do this for your projects, and for step by step instructions, see the ramblings site.

(function() { var po = document.createElement(‘script’); po.type = ‘text/javascript’; po.async = true; po.src = ‘https://apis.google.com/js/plusone.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(po, s); })();

Author: bm082975

Leave a Reply

Your email address will not be published. Required fields are marked *