Class SlidesApp

SlidesApp

Creates and opens Presentations that can be edited.

 // Open a presentation by ID.
 var preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE');

 // Create and open a presentation.
 preso = SlidesApp.create('Presentation Name');
 

Properties

PropertyTypeDescription
AlignmentPositionAlignmentPositionAn enumeration of the types of alignment positions.
ArrowStyleArrowStyleAn enumeration of the different arrow styles that a Line can have.
AutoTextTypeAutoTextTypeAn enumeration of the types of auto text.
CellMergeStateCellMergeStateAn enumeration of the different merge states of a table cell.
ColorTypeColorTypeAn enumeration of color types.
DashStyleDashStyleAn enumeration of the different dash styles that a Line can have.
FillTypeFillTypeAn enumeration of fill types.
LineCategoryLineCategoryAn enumeration of the categories of Line.
LineFillTypeLineFillTypeAn enumeration of the types of LineFill.
LineTypeLineTypeAn enumeration of the types of Line.
LinkTypeLinkTypeAn enumeration of the types of links.
ListPresetListPresetAn enumeration of the types of list presets.
PageBackgroundTypePageBackgroundTypeAn enumeration of the types of page backgrounds.
PageElementTypePageElementTypeAn enumeration of the types of page elements.
PageTypePageTypeAn enumeration of the types of pages.
ParagraphAlignmentParagraphAlignmentAn enumeration of the types of paragraph alignment.
PlaceholderTypePlaceholderTypeAn enumeration of the types of placeholders.
PredefinedLayoutPredefinedLayoutAn enumeration of the predefined layouts.
SelectionTypeSelectionTypeAn enumeration of the types of selections.
ShapeTypeShapeTypeAn enumeration of the types of shapes.
SheetsChartEmbedTypeSheetsChartEmbedTypeAn enumeration of Sheets chart embed types.
SlidePositionSlidePositionAn enumeration of the types of slide positions.
SpacingModeSpacingModeAn enumeration of the types of spacing modes.
TextBaselineOffsetTextBaselineOffsetAn enumeration of the types of text baseline offset.
TextDirectionTextDirectionAn enumeration of the types of text directions.
ThemeColorTypeThemeColorTypeAn enumeration of theme colors.
VideoSourceTypeVideoSourceTypeAn enumeration of the types of video source.

Methods

MethodReturn typeBrief description
create(name)PresentationCreates and opens a new Presentation.
getActivePresentation()PresentationReturns the currently active presentation to which the script is container-bound, or null if there is no active presentation.
getUi()UiReturns an instance of the presentation's user-interface environment that allows the script to add features like menus, dialogs, and sidebars.
newAffineTransformBuilder()AffineTransformBuilderReturns a new AffineTransformBuilder to build an AffineTransform.
openById(id)PresentationOpens the Presentation with the given ID.
openByUrl(url)PresentationOpens the Presentation with the given URL.

Detailed documentation

create(name)

Creates and opens a new Presentation.

Parameters

NameTypeDescription
nameStringThe name to be given to the created presentation.

Return

Presentation — the presentation with the given name.


getActivePresentation()

Returns the currently active presentation to which the script is container-bound, or null if there is no active presentation. To interact with a presentation to which the script is not container-bound, use openById(id) instead.

 // Get the current presentation to which this script is bound.
 var presentation = SlidesApp.getActivePresentation();
 
If the presentation is already open, the same presentation instance is returned.

Return

Presentation


getUi()

Returns an instance of the presentation's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. A script can only interact with the UI for the current instance of an open presentation, and only if the script is bound to the presentation. For more information, see the guides to menus and dialogs and sidebars.

 // Add a custom menu to the active presentation, including a separator and a sub-menu.
 function onOpen(e) {
   SlidesApp.getUi()
       .createMenu('My Menu')
       .addItem('My menu item', 'myFunction')
       .addSeparator()
       .addSubMenu(SlidesApp.getUi().createMenu('My sub-menu')
           .addItem('One sub-menu item', 'mySecondFunction')
           .addItem('Another sub-menu item', 'myThirdFunction'))
       .addToUi();
 }
 

Return

Ui


newAffineTransformBuilder()

Returns a new AffineTransformBuilder to build an AffineTransform. The builder is preset with the identity affine transform.

Return

AffineTransformBuilder


openById(id)

Opens the Presentation with the given ID.

 // Open a presentation by ID.
 var presentation = SlidesApp.openById('docId');
 
If the presentation is already open, the same presentation instance is returned.

Parameters

NameTypeDescription
idString

Return

Presentation — the presentation with the given ID


openByUrl(url)

Opens the Presentation with the given URL.

 // Open a presentation by URL.
 var presentation = SlidesApp.openByUrl('https://docs.google.com/presentation/d/docId/edit');
 
If the presentation is already open, the same presentation instance is returned.

Parameters

NameTypeDescription
urlString

Return

Presentation — the presentation with the given URL

Send feedback about...

Apps Script
Apps Script