Class SlidesApp

  • SlidesApp is used to create and open editable presentations.

  • You can open a presentation using its ID or URL, or create a new one with a specified name.

  • SlidesApp provides access to numerous properties defining elements and styles within presentations, such as alignment, colors, and shapes.

  • Methods are available to get the active presentation, access the user interface, and build affine transformations.

SlidesApp

Creates and opensPresentations that can be edited.

// Open a presentation by ID.letpreso=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 aLine can have.
AutoTextTypeAutoTextTypeAn enumeration of the types of auto text.
AutofitTypeAutofitTypeAn enumeration of autofit types.
CellMergeStateCellMergeStateAn enumeration of the different merge states of a table cell.
ColorTypeColorTypeAn enumeration of color types.
ContentAlignmentContentAlignmentAn enumeration of values used to specify content alignment.
DashStyleDashStyleAn enumeration of the different dash styles that aLine can have.
FillTypeFillTypeAn enumeration of fill types.
LineCategoryLineCategoryAn enumeration of the categories ofLine.
LineFillTypeLineFillTypeAn enumeration of the types ofLineFill.
LineTypeLineTypeAn enumeration of the types ofLine.
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.
SlideLinkingModeSlideLinkingModeAn enumeration of the ways Slides can be linked.
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 newPresentation.
getActivePresentation()Presentation|nullReturns the currently active presentation to which the script iscontainer-bound, ornull if there is noactive presentation.
getUi()UiReturns an instance of the presentation's user-interface environment that allows the script toadd features like menus, dialogs, and sidebars.
newAffineTransformBuilder()AffineTransformBuilderReturns a newAffineTransformBuilder to build anAffineTransform.
openById(id)PresentationOpens thePresentation with the given ID.
openByUrl(url)PresentationOpens thePresentation with the given URL.

Detailed documentation

create(name)

Creates and opens a newPresentation.

Parameters

NameTypeDescription
nameStringThe name to be given to the created presentation.

Return

Presentation — the presentation with the given name.

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations

getActivePresentation()

Returns the currently active presentation to which the script iscontainer-bound, ornull if there is noactive presentation. To interact with a presentation to which the script is notcontainer-bound, useopenById(id) instead.

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

Return

Presentation|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getUi()

Returns an instance of the presentation's user-interface environment that allows the script toadd features like menus, dialogs, and sidebars. A script can only interact with the UI for thecurrent instance of an open presentation, and only if the script isbound to the presentation. For more information, seethe guides tomenus anddialogs and sidebars.

// Add a custom menu to the active presentation, including a separator and a// sub-menu.functiononOpen(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 newAffineTransformBuilder to build anAffineTransform. The builderis preset with the identity affine transform.

Return

AffineTransformBuilder


openById(id)

Opens thePresentation with the given ID.

// Open a presentation by ID.constpresentation=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

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations

openByUrl(url)

Opens thePresentation with the given URL.

// Open a presentation by URL.constpresentation=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

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.