Thursday, July 5, 2012

Google Apps Script: hands-on

Update: You can find a "benchmark" at the end of this post.

Thinking about using Google Apps Script for your next project? Think again.

I have spent the last three days tinkering with Google Apps Script, and eventually came to the conclusion that it's not a good fit for "real" (?) developers. Of course, it's really easy to use: 'GmailApp.getInboxThreads()' and you have an array of all the threads in your inbox. Similar usage for other Google APIs like Calendar, Drive, etc...

However, pretty much every operation is slow. Displaying a simple form (containing a textbox and a button)? Takes a few seconds, because every single bit of code is sandboxed a thousand times (yes, I like security too, but not if it's slowing you down). Moreover, everything is overly complicated because they mostly reinvented the wheel in the first place (especially for UI).

One more thing that really turns me off of this is the Authorization screen:
The authorization screen for all Google Apps Scripts accessing sensitive data

Not only that it looks like a really bad phishing attack, I doubt that anyone actually reads the text (to be honest, I think I never made it past the bold text myself). No, I'm not able to customize this page in any way. (see update at the end of this post)

Borrowed from
Oh, and, like one of my professors always told us, to provide "good" feedback using the feedback-sandwich-method lastly one more thing that's awesome about Google Apps Script: the editor is really easy and intuitive to use (despite some minor quirks). Give it a try!

Keeping all these facts in mind, I wouldn't suggest you to use Google Apps Script if you're already familiar with things like Eclipse, Java, JavaScript, ... In case you aren't: go and give Apps Script a try! Even if you are familiar with the mentioned tools, you should give GAS a try. I mean, who the hell cares what I think, anyway? :D

Update: +Nikhil Singhal told me to use the recently introduced HTML service in order to build faster UIs. The problem is, that I've already been using it, but the time it takes to load the above mentioned form is still too long. Let's take a look at the HTML:

    function onSuccess(result) {
      document.getElementById('result').innerText = result;
    <form id='search'>
      <input type='text' name='address' />
      <input type='button' value='Search uss!'
      onclick='' />
    <div id='result'>

That's it. So, how long does it take to load this "website" (of course, without the authorization process)?  10 seconds. Is it just me? Try it yourself here.

Moreover, Nikhil assured me that they're working to make the authorization screen "better/cleaner/simpler". I take you by your word! ;)


  1. another big problem with google apps script is that the platform is highly unstable.
    every version update breaks the code you already wrote, and google team doesnt even care... as said before, google is not so good with platforms! (Stevey's Google Platforms Rant

  2. Yes very slow what "sandboxed" means? You find solme solution since your post ?

    1. Unfortunately not. To be honest, I didn't even give Apps Script another try in the mean time. However, a Google engineer assured me at the time of this blog post that they're working on fixing this issue.

  3. I'm a professional developer. I've worked with GAS the past several weeks to see if we could use it for some productivity tools we need to develop.

    I agree GAS is slow. 4 seconds for a trivial web app page is good. It will take longer displaying from within a spreadsheet, like 7 seconds. I included jQuery as the docs suggested and started to get 15 second times.

    I suspect the automatic sanitization of the code with Caja and the huge HTML that's delivered (iframe heaven!) cause at least some of this.

    GAS is a very nice idea but the implementation seems to get in the way. I found Caja disappeared code (coded as per docs, honest!). Code and objects I want to refer to seem to end up in different iframes or something. I found it very frustrating to do anything substantial in it.

    I had high hopes for it but I can't recommend GAS for more than fairly trivial productivity aids.