Google Apps Script
What is a Script?
Section titled “What is a Script?”A script is a series of instructions you write in a programming language or scripting language to accomplish a particular task. You type in the instructions and save them as a script. The script runs only under circumstances you define. Google Apps Script is based upon JavaScript. In addition to providing much of what’s built into JavaScript, Google Apps Script also provides a set of classes that make up the Google Apps Script API. You can use these classes and their associated methods to access Google products, make requests to third-party services and APIs, and access helpful utilities. You can learn more about these topics in the sections on Using Built-in Services and Using External APIs.
Sample Code:
function createAndSendDocument() { // 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();
// 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 from my first Google Apps Script!', 'Here is a link to a document created by my ' + 'first Google Apps Script: ' + url);}
