Google Apps Script

Base Service

This service provides access to user information such as email addresses and user names. It also controls script logs and Google Apps-specific dialog boxes.

Classes

NameBrief description
BlobA data interchange object for Apps Script services.
BlobSourceInterface for objects that can export their data as a Blob.
BrowserThis class provides access to Google Apps specific dialog boxes.
ButtonAn enum representing predetermined, localized dialog buttons returned by an alert or PromptResponse.getSelectedButton() to indicate which button in a dialog the user clicked.
ButtonSetAn enum representing predetermined, localized sets of one or more dialog buttons that can be added to an alert or a prompt.
LoggerThis class allows the developer to write out text to the debugging logs.
MenuA custom menu in an instance of the user interface for a Google App.
MimeTypeAn enumeration that provides access to MIME-type declarations without typing the strings explicitly.
MonthAn enum representing the months of the year.
PromptResponseA response to a prompt dialog displayed in the user-interface environment for a Google App.
SessionThe Session class provides access to session information, such as the user's email address (in some circumstances) and language setting.
UiAn instance of the user-interface environment for a Google App that allows the script to add features like menus, dialogs, and sidebars.
UserRepresentation of a user, suitable for scripting.
WeekdayAn enum representing the days of the week.

Class Blob

Methods

MethodReturn typeBrief description
copyBlob()BlobReturns a copy of this blob.
getAs(contentType)BlobReturn the data inside this object as a blob converted to the specified content type.
getBytes()Byte[]Gets the data stored in this blob.
getContentType()StringGets the content type of the bytes in this blob.
getDataAsString()StringGets the data of this blob as a String with UTF-8 encoding.
getDataAsString(charset)StringGets the data of this blob as a string with the specified encoding.
getName()StringGets the name of this blob.
isGoogleType()BooleanReturns whether this blob is a Google Apps file (Sheets, Docs, etc.).
setBytes(data)BlobSets the data stored in this blob.
setContentType(contentType)BlobSets the content type of the bytes in this blob.
setContentTypeFromExtension()BlobSets the content type of the bytes in this blob based on the file extension.
setDataFromString(string)BlobSets the data of this blob from a string with UTF-8 encoding.
setDataFromString(string, charset)BlobSets the data of this blob from a string with the specified encoding.
setName(name)BlobSets the name of this blob.

Class BlobSource

Methods

MethodReturn typeBrief description
getAs(contentType)BlobReturn the data inside this object as a blob converted to the specified content type.
getBlob()BlobReturn the data inside this object as a blob.

Class Browser

Properties

PropertyTypeDescription
ButtonsButtonSet

Methods

MethodReturn typeBrief description
inputBox(prompt)StringPops up a dialog box with a text input box in the user's browser.
inputBox(prompt, buttons)StringPops up a dialog box with a text input box in the user's browser.
inputBox(title, prompt, buttons)StringPops up a dialog box with a text input box in the user's browser.
msgBox(prompt)StringPops up a dialog box with the given message and an OK button in the user's browser.
msgBox(prompt, buttons)StringPops up a dialog box with the given message and specified buttons in the user's browser.
msgBox(title, prompt, buttons)StringPops up a dialog box with the given title, message and specified buttons in the user's browser.

Class Button

Properties

PropertyTypeDescription
CLOSEEnumThe standard close button displayed in every dialog's title bar.
OKEnumAn "OK" button, indicating that an operation should proceed.
CANCELEnumA "Cancel" button, indicating that an operation should not proceed.
YESEnumA "Yes" button, indicating a positive response to a question.
NOEnumA "No" button, indicating a negative response to a question.

Class ButtonSet

Properties

PropertyTypeDescription
OKEnumA single "OK" button, indicating an informational message that can only be dismissed.
OK_CANCELEnumAn "OK" button and a "Cancel" button, allowing the user to either proceed with or halt an operation.
YES_NOEnumA "Yes" button and a "No" button, allowing the user to answer a yes/no question.
YES_NO_CANCELEnumA "Yes" button, a "No" button, and a "Cancel" button, allowing the user to either answer a yes/no question or halt an operation.

Class Logger

Methods

MethodReturn typeBrief description
clear()voidClears the log.
getLog()StringReturns a complete list of messages in the current log.
log(data)LoggerWrites the string to the logging console.
log(format, values)LoggerWrites a formatted string to the logging console, using the format and values provided.

Class Menu

Methods

MethodReturn typeBrief description
addItem(caption, function)MenuAdds an item to the menu.
addSeparator()MenuAdds a visual separator to the menu.
addSubMenu(menu)MenuAdds a sub-menu to the menu.
addToUi()voidInserts the menu into the instance of the editor's user interface.

Class MimeType

Properties

PropertyTypeDescription
GOOGLE_APPS_SCRIPTEnumRepresentation of MIME type for a Google Apps Script project.
GOOGLE_DRAWINGSEnumRepresentation of MIME type for a Google Drawings file.
GOOGLE_DOCSEnumRepresentation of MIME type for a Google Docs file.
GOOGLE_FORMSEnumRepresentation of MIME type for a Google Forms file.
GOOGLE_SHEETSEnumRepresentation of MIME type for a Google Sheets file.
GOOGLE_SLIDESEnumRepresentation of MIME type for a Google Slides file.
FOLDEREnumRepresentation of MIME type for a Google Drive folder.
BMPEnumRepresentation of MIME type for a BMP image file (typically .bmp).
GIFEnumRepresentation of MIME type for a GIF image file (typically .gif).
JPEGEnumRepresentation of MIME type for a JPEG image file (typically .jpg).
PNGEnumRepresentation of MIME type for a PNG image file (typically .png).
SVGEnumRepresentation of MIME type for an SVG image file (typically .svg).
PDFEnumRepresentation of MIME type for a PDF file (typically .pdf).
CSSEnumRepresentation of MIME type for a CSS text file (typically .css).
CSVEnumRepresentation of MIME type for a CSV text file (typically .csv).
HTMLEnumRepresentation of MIME type for an HTML text file (typically .html).
JAVASCRIPTEnumRepresentation of MIME type for a JavaScript text file (typically .js).
PLAIN_TEXTEnumRepresentation of MIME type for a plain text file (typically .txt).
RTFEnumRepresentation of MIME type for a rich text file (typically .rtf).
OPENDOCUMENT_GRAPHICSEnumRepresentation of MIME type for an OpenDocument graphics file (typically .odg).
OPENDOCUMENT_PRESENTATIONEnumRepresentation of MIME type for an OpenDocument presentation file (typically .odp).
OPENDOCUMENT_SPREADSHEETEnumRepresentation of MIME type for an OpenDocument spreadsheet file (typically .ods).
OPENDOCUMENT_TEXTEnumRepresentation of MIME type for an OpenDocument word-processing file (typically .odt).
MICROSOFT_EXCELEnumRepresentation of MIME type for a Microsoft Excel spreadsheet file (typically .xlsx).
MICROSOFT_EXCEL_LEGACYEnumRepresentation of MIME type for a Microsoft Excel legacy file (typically .xls).
MICROSOFT_POWERPOINTEnumRepresentation of MIME type for a Microsoft PowerPoint presentation file (typically .pptx).
MICROSOFT_POWERPOINT_LEGACYEnumRepresentation of MIME type for a Microsoft PowerPoint legacy file (typically .ppt).
MICROSOFT_WORDEnumRepresentation of MIME type for a Microsoft Word document file (typically .docx).
MICROSOFT_WORD_LEGACYEnumRepresentation of MIME type for a Microsoft Word legacy file (typically .doc).
ZIPEnumRepresentation of MIME type for a ZIP archive file (typically .zip).

Class Month

Properties

PropertyTypeDescription
JANUARYEnumJanuary (month 1).
FEBRUARYEnumFebruary (month 2).
MARCHEnumMarch (month 3).
APRILEnumApril (month 4).
MAYEnumMay (month 5).
JUNEEnumJune (month 6).
JULYEnumJuly (month 7).
AUGUSTEnumAugust (month 8).
SEPTEMBEREnumSeptember (month 9).
OCTOBEREnumOctober (month 10).
NOVEMBEREnumNovember (month 11).
DECEMBEREnumDecember (month 12).

Class PromptResponse

Methods

MethodReturn typeBrief description
getResponseText()StringGets the text that the user entered in the dialog's input field.
getSelectedButton()ButtonGets the button that the user clicked to dismiss the dialog.

Class Session

Methods

MethodReturn typeBrief description
getActiveUser()UserGets information about the current user.
getActiveUserLocale()StringGets the language setting of the current user as a two-letter string — for example, en for English.
getEffectiveUser()UserGets information about the user under whose authority the script is running.
getScriptTimeZone()StringGets the time zone of the script.

Class Ui

Properties

PropertyTypeDescription
ButtonButtonAn enum representing predetermined, localized dialog buttons returned by an alert or PromptResponse.getSelectedButton() to indicate which button in a dialog the user clicked.
ButtonSetButtonSetAn enum representing predetermined, localized sets of one or more dialog buttons that can be added to an alert or a prompt.

Methods

MethodReturn typeBrief description
alert(prompt)ButtonOpens a dialog box in the user's editor with the given message and an "OK" button.
alert(prompt, buttons)ButtonOpens a dialog box in the user's editor with the given message and set of buttons.
alert(title, prompt, buttons)ButtonOpens a dialog box in the user's editor with the given title, message, and set of buttons.
createAddonMenu()MenuCreates a builder that can be used to insert a sub-menu into the editor's Add-on menu.
createMenu(caption)MenuCreates a builder that can be used to add a menu to the editor's user interface.
prompt(prompt)PromptResponseOpens an input dialog box in the user's editor with the given message and an "OK" button.
prompt(prompt, buttons)PromptResponseOpens an input dialog box in the user's editor with the given message and set of buttons.
prompt(title, prompt, buttons)PromptResponseOpens an input dialog box in the user's editor with the given title, message, and set of buttons.
showModalDialog(userInterface, title)voidOpens a modal dialog box in the user's editor with custom client-side content.
showModelessDialog(userInterface, title)voidOpens a modeless dialog box in the user's editor with custom client-side content.
showSidebar(userInterface)voidOpens a sidebar in the user's editor with custom client-side content.

Class User

Methods

MethodReturn typeBrief description
getEmail()StringGets the user's email address, if available.

Class Weekday

Properties

PropertyTypeDescription
SUNDAYEnumSunday.
MONDAYEnumMonday.
TUESDAYEnumTuesday.
WEDNESDAYEnumWednesday.
THURSDAYEnumThursday.
FRIDAYEnumFriday.
SATURDAYEnumSaturday.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.