Post on 13-Jun-2015
description
transcript
Google App Script
Aakash Goel
http://gplus.to/aakashg
Don't Hate, Automate!
© Copyright GDG BVP 2012
Raise your hand
Ever heard of Google App Script?
Who uses Google Drive?
Google Docs???
© Copyright GDG BVP 2012
Agenda
Is Apps Script for you?
Features of Apps Script ServicesoDocs ServicesoMail, Calendar, ContactsoIntegration ServicesoUI ServicesoUtilities & Debugger
Demos
Getting Started
© Copyright GDG BVP 2012
WHAT is App Script?
JavaScript engine in the cloud
o JavaScript Runtimeo Execute on Google's cloudo Integrates with Google's Services
Comes with
o JavaScript syntax and base classeso Built-in access to various Google APIso Ability to integrate 3rd party serviceso Online editor: Write code in the browser
© Copyright GDG BVP 2012
WHY App Script?
Easy to Use
oWrite on the web, run on the weboNo hardware, software, deployments, maintenance etc..oJavaScript syntax
Don't hate, Automate!
© Copyright GDG BVP 2012
WHERE is App Script?
Executed in a variety of different ways
o Spreadsheet
o Google Sites
o Standalone with Custom UI
o Asynchronous Triggers
© Copyright GDG BVP 2012
WHO can use App Script?
Anyone CAN SCRIPT!
© Copyright GDG BVP 2012
WHO can use App Script?
© Copyright GDG BVP 2012
App Script Services
Google products
o Spreadsheeto Siteso DocList
o Gmailo Contactso Calendar
o Mapso Finance ...
© Copyright GDG BVP 2012
App Script Services
External services
oURL Fetch + OAutho JDBCo SOAPo XML
Other
oUI Serviceso WYSIWYG Editoro Charts
© Copyright GDG BVP 2012
Triggers
Triggers allow asynchronous execution of scripts
Types of Triggers:
oEvent DrivenoTime Driven
Advantage:
Helps in Automation
© Copyright GDG BVP 2012
Demos
Save Gmail attachment automatically to Drive
goo.gl/YLm2W
MCQ tests: email score & correction
Drive Eye
Flubaroo
© Copyright GDG BVP 2012
Need a Break??
© Copyright GDG BVP 2012
Getting Started
© Copyright GDG BVP 2012
Hello World
function myFunction() {
// Create a new document with the title 'Hello World' var doc = DocumentApp.create('Hello World');
// Add a paragraph to the document doc.appendParagraph('This document was created by my first Google Apps Script.');
// Save and close the document doc.saveAndClose();
}
© Copyright GDG BVP 2012
Hello World
function myFunction() { …
// Get the URL of the document var url = doc.getUrl();
// Get the email address of the active user - that's you var emailAddress = Session.getActiveUser().getEmail();
// Send yourself an email with a link to the document GmailApp.sendEmail(emailAddress, “Hello World', ‘Link to a document created by my ' + 'first Google Apps Script: ' + url);}
© Copyright GDG BVP 2012
Custom Spreadsheet Function
function c2f(inp) {
// Function to convert from Celsius to Fahrenheit. var out = 0; // this will hold the answer
if (typeof inp != "number") { // check to make sure the input is a number throw "Input value must be a number"; // throw an exception with the error message }
out = (inp*9)/5 + 32; // calculate the answer return out; // return the answer to the cell which has the formula
}
© Copyright GDG BVP 2012
Calendar Event
function myFunction() {
//Create an object of the Default calender in use. var calender = CalendarApp.getDefaultCalendar(); //startDate will correspond to the current date and time. var startDate = new Date();
//endDate will be same as the startDate. var endDate = new Date(startDate); //Increment the hours of endDate by 2 as the duration of the event is 2 hrs. endDate.setHours(startDate.getHours() + 2); //Create the Event. var event = calender.createEvent("Hackathon", startDate, endDate);
}
© Copyright GDG BVP 2012
Contact Me
Google Plushttp://gplus.to/aakashg
Twitter@goelaakash9
Email Idgscript.bvp@gmail.com
© Copyright GDG BVP 2012
Feedback
Feedback Form
http://goo.gl/jLzWu