google apps script tutorial

Few people brought to my attention google apps script so I did a little test drive today, and I am quite impressed. This suppose this is google's take on server-side JavaScript, that integrates with their google docs family and much more...

Here is one use case that I tested: loading list of users from a remote JSON service, and storing it in google spreadsheet.

// Inserts user into spreadseet.
var insertUser = function (user) {
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow([, user.userType]);

// Request service.
var service = function (url, callBack) {
  var response = UrlFetchApp.fetch(url),
      responseObj = JSON.parse(response.getContentText());

// Main init function.
function run() {
  var url = '';

  service(url, function(d){
    var users =;
    for (var i = 0; i < users.length; i++) {