1 of 9

Recent Updates in Google Apps Script

GDG-NYC Jan 2014

2 of 9

Who are you?

Allen “Prisoner” Firstenberg

Developer, GDE

http://prisoner.com/

3 of 9

What is Apps Script again?

“Google Apps Script is a scripting language based on JavaScript that lets you do new and cool things with Google Apps like Docs, Sheets, and Forms. There's nothing to install — we give you a code editor right in your browser, and your scripts run on Google's servers.”

https://developers.google.com/apps-script/overview

4 of 9

Meaning What?

Apps Script is versatile. Among other things, you can:

  • Add custom menus, dialogs, and sidebars to Google Docs, Sheets, and Forms
  • Write custom functions for Google Sheets
  • Publish web apps — either standalone or embedded in Google Sites
  • Interact with other Google services, including AdSense, Analytics, Calendar, Drive, Finance, Gmail, and Maps

https://developers.google.com/apps-script/overview

5 of 9

So what is new?

Two major changes recently:

  • More Advanced Services
  • More JavaScript-y API for those services

http://googleappsdeveloper.blogspot.com/2013/12/more-google-services-available-in-apps.html

6 of 9

More advanced services

Built in services: GMail, Docs, Sheets

Advanced services: Analytics, Tasks

7 of 9

More JavaScript-y API

Old way:

function insertTimelineItem() {

var timelineItem = Mirror.newTimelineItem();

timelineItem.text = 'Hello world!';

var notificationConfig = Mirror.newNotificationConfig();

notificationConfig.level = 'AUDIO_ONLY';

var menuItem = Mirror.newMenuItem();

menuItem.action = 'REPLY';

timelineItem.notification = notificationConfig;

timelineItem.menuItems = [menuItem];

Mirror.Timeline.insert(timelineItem);

}

Pros: Editor syntactical support. Matches Java API.

Cons: Tedious. Matches Java API.

8 of 9

More JavaScript-y API

New way:

function insertTimelineItem() {

var timelineItem = {

text: 'Hello world!',

notification: {level:'DEFAULT'},

menu: [{action:'REPLY'}]

}

Mirror.Timeline.insert(timelineItem);

}

Pros: Terse.

Cons: Terse. No editor support.

(But you can mix the two styles if you want.)

9 of 9

Questions?

Google Apps Script