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.
The official API reference for the Spreadsheet Service can be found at https://developers.google.com/apps-script/reference/spreadsheet/.
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);
}
This is an example form web app, the client-side bit shows some basic UX design, such as a disabled submit button when the form is submitting, or an error message if it fails...etc
The Apps Script bit is very basic. It contains just the code necessary to serve up the html, and to validate the field.
Here is a link to this example app in action: Example Apps Script Form
Note: You must be signed into a Google account.
The Apps Script file structure is as so:
Method: getActive()
Return Type: Spreadsheet
See also the official API reference for the GmailApp for further details on the available methods.
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.
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
The Web Script must be published in order to work.
Pops ups must be enabled for https://script.google.com