google-apps-script

Topics related to google-apps-script:

Getting started with google-apps-script

The official overview for Google Apps Script is published at http://www.google.com/script/start, from there

Google Apps Script is a JavaScript cloud scripting language that provides easy ways to automate tasks across Google products and third party services and build web applications.

From https://developers.google.com/apps-script/guides/services/#basic_javascript_features

Apps Script is based on JavaScript 1.6, plus a few features from 1.7 and 1.8. Many basic JavaScript features are thus available in addition to the built-in and advanced Google services: you can use common objects like Array, Date, RegExp, and so forth, as well as the Math and Object global objects. However, because Apps Script code runs on Google's servers (not client-side, except for HTML-service pages), browser-based features like DOM manipulation or the Window API are not available.

Spreadsheet Service

DriveApp Service - Files by type and search string

Spreadsheet Add Menu

Usually, you will want to call addMenu from the onOpen function so that the menu is automatically created when the Spreadsheet is loaded.

 // The onOpen function is executed automatically every time a Spreadsheet is loaded
 function onOpen() {
   var activeSheet = SpreadsheetApp.getActiveSpreadsheet();
   var menuItems = [];
   // When the user clicks on "addMenuExample" then "Menu 1", the function Myfunction1 is executed.
   menuItems.push({name: "Menu 1", functionName: "Myfunction1"});
   menuItems.push(null); // adding line separator
   menuItems.push({name: "Menu 2", functionName: "Myfunction2"});

   activeSheet.addMenu("addMenuExample", menuEntries);
 }

Apps Script Web Apps

Google sheets MailApp

DriveApp

Create a custom function for Google Sheets

SpreadsheetApp Active Sheet

GmailApp

See also the official API reference for the GmailApp for further details on the available methods.

DriveApp - getFileById(id)

It is also possible to get a file by the file's URL. The ID of a file is in the url, so using the ID instead of the entire URL means that the parameter is shorter. Storing the URL rather than the ID takes up more space.

DriveApp Service

Google Mime types can not be used for the third parameter of Mime Types. Using a Google Mime Type will result in an error that states:

Cannot use "DriveApp.createFile()" to create Google MIME types. Please use Advanced Drive Service

MimeType.GOOGLE_APPS_SCRIPT

MimeType.GOOGLE_DOCS

MimeType.GOOGLE_DRAWINGS

MimeType.GOOGLE_FORMS

MimeType.GOOGLE_SHEETS

MimeType.GOOGLE_SLIDES

Google Web App Script To Auto Download From Google Drive

Client calls to Google apps-script

Firebase and AppScript : Introduction