google apps script the authentic{ated} mobile playground

40
This work is licensed under a Creative Commons Attribution 4.0 Unported License . CC-BY mhawksey Google Apps Script: +Martin Hawksey @mhawksey The authentic{ated} playground http://bit.ly/EdMobGAS

Upload: martin-hawksey

Post on 22-Jan-2018

189 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Google Apps Script the Authentic{ated} Mobile Playground

This work is licensed under a Creative Commons

Attribution 4.0 Unported License. CC-BY mhawksey

Google Apps Script:

+Martin Hawksey@mhawksey

The authentic{ated} playground

http://bit.ly/EdMobGAS

Page 2: Google Apps Script the Authentic{ated} Mobile Playground

http://bit.ly/EdMobGAS

Page 3: Google Apps Script the Authentic{ated} Mobile Playground

Google G Suite...

Page 4: Google Apps Script the Authentic{ated} Mobile Playground

Google Apps Script

CC-BY Google – Google Apps Script, 13-03-2012

Page 5: Google Apps Script the Authentic{ated} Mobile Playground

JavaScript in the cloud

Apps Script is based on JavaScript 1.6, plus a few features from 1.7 and 1.8.

Page 6: Google Apps Script the Authentic{ated} Mobile Playground

Where..

StandaloneSheets DocsForms Sites

Page 7: Google Apps Script the Authentic{ated} Mobile Playground

A brief history

2009

Scripts in SheetsCustom functions

2010

UiApp*Web Apps (run as developer)Script Gallery*

2011

Scripts in SitesGUI Builder*More services

2012

Standalone scriptsHTMLSerivceScriptDb*Web Apps (run as user)Libraries and versioningContent ServiceChrome Web Store

2013

Scripts in DocScripts in FormsAuth flowMore services

2014

Add-on for Documents, Sheets and FormsIFRAME for HTMLService

* Denotes deprecated services/features

Adapted from Wesley Chun’s Google Apps Script

2015

Execution API

2016

Iframe EmbedAndroid Add-ons

Page 8: Google Apps Script the Authentic{ated} Mobile Playground

Integration

CC-BY-NC Eugen Stollhttps://flic.kr/p/5c6ce

Page 10: Google Apps Script the Authentic{ated} Mobile Playground

One liners

Page 11: Google Apps Script the Authentic{ated} Mobile Playground

One liners

Page 12: Google Apps Script the Authentic{ated} Mobile Playground

One liners{ish}

Page 13: Google Apps Script the Authentic{ated} Mobile Playground

Toast

Page 14: Google Apps Script the Authentic{ated} Mobile Playground

One liners services

Calendar

Contacts

Document

Drive

Forms

Gmail

Groups

Language

Maps

Sites

Spreadsheet

Page 16: Google Apps Script the Authentic{ated} Mobile Playground

Fetch...

BY-NC-SA tartemehttps://flic.kr/p/bAoEyi

Page 17: Google Apps Script the Authentic{ated} Mobile Playground

…fetch

UrlFetchApp.fetch(url, params);

This service allows scripts to access other resources on the

web by fetching URLs. A script can use the UrlFetch service

to issue HTTP and HTTPS requests and receive responses.

The UrlFetch service uses Google's network infrastructure

for efficiency and scaling purposes.

Page 18: Google Apps Script the Authentic{ated} Mobile Playground

Identity

CC-BY-NC Thomas Hawk https://flic.kr/p/bUy6wK

Page 19: Google Apps Script the Authentic{ated} Mobile Playground

Google Apps Script Web apps

Page 20: Google Apps Script the Authentic{ated} Mobile Playground

Google Add-ons

CC-BY gail heidelhttps://flic.kr/p/65aFCx

Page 21: Google Apps Script the Authentic{ated} Mobile Playground

Customising Sheets, Documents and Forms...

Sheets + Add-ons Documents + Add-ons Forms + Add-ons

Page 22: Google Apps Script the Authentic{ated} Mobile Playground

Domain distribution

Page 23: Google Apps Script the Authentic{ated} Mobile Playground

Android Add-ons

CC-BY gail heidelhttps://flic.kr/p/65aFCx

Page 24: Google Apps Script the Authentic{ated} Mobile Playground

… for Google Docs and Sheets

Android add-ons are apps that can be called

from Google Docs or Google Sheets editor apps,

and are built by developers to enhance or extend

the capabilities of those editors.

Page 25: Google Apps Script the Authentic{ated} Mobile Playground

The Android Add-on experience…

Page 26: Google Apps Script the Authentic{ated} Mobile Playground

Execution API…

CC-BY-NC-ND Dizzy Girlhttps://flic.kr/p/cpvb9

Page 27: Google Apps Script the Authentic{ated} Mobile Playground

Execution API...

The Execution API is a REST interface that lets a

third-party application call a function defined in

an Apps Script project and receive a response.

This API lets you expose the full utility of Apps

Script to any application, including Android and

iOS apps.

Page 28: Google Apps Script the Authentic{ated} Mobile Playground

Limits…

CC-BY-NC Chris Campbellhttps://flic.kr/p/5YdSeh

Page 29: Google Apps Script the Authentic{ated} Mobile Playground

FeatureConsumer

(gmail.com)

Google Apps free edition

(legacy)G Suite Basic/Business/Edu/Gov

Calendar events created 5,000 / day 10,000 / day 10,000 / day

Contacts created 1,000 / day 2,000 / day 2,000 / day

Documents created 250 / day 500 / day 1,500 / day

Email recipients per day 100* / day 100* / day 1,500* / day

Email read/write

(excluding send)

20,000 / day 40,000 / day 50,000 / day

Spreadsheets created 250 / day 500 / day 3,200 / day

Triggers total runtime 90 min / day 3 hr / day 6 hr / day

URL Fetch calls 20,000 / day 50,000 / day 100,000 / day

URL Fetch data received 100MB / day 100MB / day 100MB / day

Page 30: Google Apps Script the Authentic{ated} Mobile Playground

FeatureConsumer

(gmail.com)

Google Apps free edition

(legacy)

G Suite

Basic/Business/Edu/Gov

Script runtime 6 min / execution 6 min / execution 6 min / execution

Email attachments 250 / msg 250 / msg 250 / msg

Email body size 200kB / msg 200kB / msg 400kB / msg

Email recipients per

message

50 / msg 50 / msg 50 / msg

Email total

attachments size

25MB / msg 25MB / msg 25MB / msg

URL Fetch headers 100 / call 100 / call 100 / call

URL Fetch header size 8kB / call 8kB / call 8kB / call

URL Fetch POST size 10MB / call 10MB / call 10MB / call

URL Fetch URL length 2kB / call 2kB / call 2kB / call

Page 31: Google Apps Script the Authentic{ated} Mobile Playground

Let's play…

CC-BY-NC-ND Elke Nodahttps://flic.kr/p/58zapN

Page 33: Google Apps Script the Authentic{ated} Mobile Playground

Client Side: Making AJAX like call

<script>

function handleFormSubmit(formObject) {

google.script.run.withSuccessHandler(updateUrl)

.processForm(formObject);

}

</script>

Page 34: Google Apps Script the Authentic{ated} Mobile Playground

Server Side: Getting the user’s email

// able to get email of who is using the form

data.engineer = Session.getEffectiveUser().getEmail();

Page 35: Google Apps Script the Authentic{ated} Mobile Playground

Server Side: Adding a file from a form to Google Drive

// we get our Pics folder

var folder = DriveApp.getFolderById('0B6GkLMU9sHmLejN2R0xUaVJfVjA');

var formBlob = formObject.myPhoto;

// sending image file to our Google Drive folder

var imgFile = folder.createFile(formBlob);

Page 36: Google Apps Script the Authentic{ated} Mobile Playground

Server Side: Writing data to a Google Sheet

// Reading a Google Sheet

var sheet = SpreadsheetApp.openById('1ANtlQPLPpC…vOIqR4wYayWdVZU4')

.getActiveSheet();

// writing the data to the sheet - each row []

var towrite = [formObject.name, … new Date(), imgFile.getUrl()];

// getRange(Integer row, Integer column, Integer numRows, Integer

numColumns) : Range

sheet.getRange(row+1, 2, 1, towrite.length).setValues([towrite]);

Page 37: Google Apps Script the Authentic{ated} Mobile Playground

Server Side: Getting Slides as PDF and emailing as attachment

// Sending a copy of the cert as pdf

// https://developers.google.com/apps-script/reference/mail/mail-app

MailApp.sendEmail('[email protected]', 'Attachment example',

'Certificate attached.', {

name: 'Automatic Emailer Script',

attachments: [DECK.getAs(MimeType.PDF)]

});

Page 38: Google Apps Script the Authentic{ated} Mobile Playground

Server Side: Getting Slides as PDF and emailing as attachment

Page 39: Google Apps Script the Authentic{ated} Mobile Playground

Community

Page 40: Google Apps Script the Authentic{ated} Mobile Playground

Thanks!

+MartinHawksey@mhawksey

mashe.hawksey.info

http://bit.ly/EdMobGAS