Google Apps Script: The authentic{ated} playground [2015 Ed.]
-
Upload
martin-hawksey -
Category
Technology
-
view
1.596 -
download
2
Transcript of Google Apps Script: The authentic{ated} playground [2015 Ed.]
![Page 1: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/1.jpg)
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://go.alt.ac.uk/GDGBerlin-AppsScript
![Page 2: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/2.jpg)
![Page 3: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/3.jpg)
CC-BY-NC-ND lukexmartin https://flic.kr/p/9dL4vY
![Page 4: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/4.jpg)
CC-BY-NC Xtream_i https://flic.kr/p/tYTwd
![Page 6: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/6.jpg)
JavaScript in the cloud
Apps Script is based on JavaScript 1.6, plus a few features from 1.7 and 1.8.
![Page 7: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/7.jpg)
A brief history
2009Scripts in SheetsCustom functions
2010UiApp*Web Apps (run as developer)Script Gallery*
2011Scripts in SitesGUI Builder*More services
2012Standalone scriptsHTMLSerivceScriptDb*Web Apps (run as user)Libraries and versioningContent ServiceChrome Web Store
2013Scripts in DocScripts in FormsAuth flowMore services
2014Add-on for Documents, Sheets and FormsIFRAME for HTMLService
* Denotes deprecated services/features
Adapted from Wesley Chun’s Google Apps Script
2015Execution API
2016???
![Page 8: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/8.jpg)
Where..
StandaloneSheets DocsForms Sites
![Page 9: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/9.jpg)
Integration
CC-BY-NC Eugen Stollhttps://flic.kr/p/5c6ce
![Page 10: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/10.jpg)
One liners
![Page 11: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/11.jpg)
One liners
![Page 12: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/12.jpg)
One liners
![Page 13: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/13.jpg)
One liners{ish}
![Page 14: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/14.jpg)
Toast
![Page 15: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/15.jpg)
Custom UI
CC-BY Google Inc. Apps Script Menus
![Page 16: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/16.jpg)
Auth
![Page 17: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/17.jpg)
One liners services
CalendarContactsDocumentDriveFormsGmail
GroupsLanguageMapsSitesSpreadsheet
![Page 18: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/18.jpg)
One{ish} liners services
AdSenseAnalyticsApps ActivityBigQueryCalendarClassroomDriveDoubleClick CampaignsFusion Tables
GmailGoogle+Google+ DomainsMirrorPredictionShopping ContentTasksURL ShortenerYouTube
![Page 19: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/19.jpg)
Advanced Services
![Page 20: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/20.jpg)
…fetch
BY-NC-SA tartemehttps://flic.kr/p/bAoEyi
![Page 21: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/21.jpg)
“…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 22: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/22.jpg)
Comparing CiviEvent
registrations for annual events
and automatically reporting on a
daily basis
Problem
![Page 23: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/23.jpg)
![Page 24: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/24.jpg)
CiviReport
![Page 25: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/25.jpg)
“Scheduled Jobs - Mail Reports (mail_report)
![Page 26: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/26.jpg)
![Page 27: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/27.jpg)
27
![Page 28: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/28.jpg)
![Page 29: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/29.jpg)
![Page 30: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/30.jpg)
Triggers
![Page 31: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/31.jpg)
Trigger
// set the script to read the email run 15min later ScriptApp.newTrigger("processInbox") .timeBased() .after(15 * 60 * 1000) .create();
![Page 32: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/32.jpg)
Hello Libraries
![Page 33: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/33.jpg)
Libraries
https://plus.google.com/+SpencerEastonCCS/posts/hrQ9eaHMUW6
![Page 34: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/34.jpg)
Identity
CC-BY-NC Thomas Hawk https://flic.kr/p/bUy6wK
![Page 35: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/35.jpg)
Google Apps Script Web apps
![Page 36: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/36.jpg)
HtmlService: Templating
function doGet() { return HtmlService .createTemplateFromFile('Index') .evaluate() .setSandboxMode(HtmlService.SandboxMode.IFRAME);}
CODE.GS
<!DOCTYPE html><html> <head> <base target="_top"> </head> <body> Hello, World! The time is <?= new Date() ?>. </body></html>
INDEX.HTML
< CC-BY Google >
![Page 37: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/37.jpg)
HtmlService: Communicate with Server
function doGet() { return HtmlService.createHtmlOutputFromFile('Index') .setSandboxMode(HtmlService.SandboxMode.IFRAME);}
function doSomething() { Logger.log('I was called!');}
CODE.GS
<!DOCTYPE html><html> <head> <base target="_top"> <script> google.script.run.doSomething(); </script> </head></html>
INDEX.HTML
< CC-BY Google >
![Page 38: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/38.jpg)
HtmlService
![Page 39: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/39.jpg)
HtmlService
![Page 40: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/40.jpg)
ContentService
function doGet() { return ContentService.createTextOutput('Hello, world!');}
function doGet(request) { var events = CalendarApp.getEvents( new Date(Number(request.parameters.start) * 1000), new Date(Number(request.parameters.end) * 1000)); var result = { available: events.length == 0 }; return ContentService.createTextOutput( request.parameters.prefix + '(' + JSON.stringify(result) + ')') .setMimeType(ContentService.MimeType.JAVASCRIPT);}
JSONP
TXT
< CC-BY Google >
![Page 41: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/41.jpg)
“ContentService
ContentService supports returning TEXT, ATOM, CSV, iCal, JavaScript,
JSON, RSS, vCard, and XML
![Page 42: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/42.jpg)
“Execution API
The Apps Script 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....can be used with Google APIs Client Libraries
![Page 43: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/43.jpg)
“Properties Service
store simple data in key-value pairs scoped to one script, one user of a script,
or one document
getScriptProperties()getUserProperties()
getDocumentProperties()
![Page 44: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/44.jpg)
Let's play…
CC-BY-NC-ND Elke Noda https://flic.kr/p/58zapN
![Page 46: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/46.jpg)
TAGS Summary
![Page 47: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/47.jpg)
TAGSExplorer
![Page 48: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/48.jpg)
TwtrService
![Page 50: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/50.jpg)
Advanced Services
![Page 51: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/51.jpg)
Google Analytics
![Page 52: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/52.jpg)
Google Analytics
![Page 53: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/53.jpg)
[demo link]
Google Analytics
![Page 54: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/54.jpg)
Twitter referral mashed with Google Analytics
![Page 55: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/55.jpg)
Translation
![Page 56: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/56.jpg)
Maps
![Page 57: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/57.jpg)
Google Add-ons
CC-BY gail heidel https://flic.kr/p/65aFCx
![Page 58: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/58.jpg)
Add-ons in action
![Page 59: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/59.jpg)
Domain distribution
![Page 60: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/60.jpg)
Community
![Page 61: Google Apps Script: The authentic{ated} playground [2015 Ed.]](https://reader036.fdocuments.us/reader036/viewer/2022062522/5875f5d61a28ab006e8b6067/html5/thumbnails/61.jpg)
Danke!
+MartinHawksey@mhawkseyEdTech Explorermashe.hawksey.info
http://go.alt.ac.uk/GDGBerlin-AppsScript