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! ;)