Class SlidesApp Stay organized with collections Save and categorize content based on your preferences.
Page Summary
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.
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
| Property | Type | Description |
|---|---|---|
Alignment | Alignment | An enumeration of the types of alignment positions. |
Arrow | Arrow | An enumeration of the different arrow styles that aLine can have. |
Auto | Auto | An enumeration of the types of auto text. |
Autofit | Autofit | An enumeration of autofit types. |
Cell | Cell | An enumeration of the different merge states of a table cell. |
Color | Color | An enumeration of color types. |
Content | Content | An enumeration of values used to specify content alignment. |
Dash | Dash | An enumeration of the different dash styles that aLine can have. |
Fill | Fill | An enumeration of fill types. |
Line | Line | An enumeration of the categories ofLine. |
Line | Line | An enumeration of the types ofLine. |
Line | Line | An enumeration of the types ofLine. |
Link | Link | An enumeration of the types of links. |
List | List | An enumeration of the types of list presets. |
Page | Page | An enumeration of the types of page backgrounds. |
Page | Page | An enumeration of the types of page elements. |
Page | Page | An enumeration of the types of pages. |
Paragraph | Paragraph | An enumeration of the types of paragraph alignment. |
Placeholder | Placeholder | An enumeration of the types of placeholders. |
Predefined | Predefined | An enumeration of the predefined layouts. |
Selection | Selection | An enumeration of the types of selections. |
Shape | Shape | An enumeration of the types of shapes. |
Sheets | Sheets | An enumeration of Sheets chart embed types. |
Slide | Slide | An enumeration of the ways Slides can be linked. |
Slide | Slide | An enumeration of the types of slide positions. |
Spacing | Spacing | An enumeration of the types of spacing modes. |
Text | Text | An enumeration of the types of text baseline offset. |
Text | Text | An enumeration of the types of text directions. |
Theme | Theme | An enumeration of theme colors. |
Video | Video | An enumeration of the types of video source. |
Methods
| Method | Return type | Brief description |
|---|---|---|
create(name) | Presentation | Creates and opens a newPresentation. |
get | Presentation|null | Returns the currently active presentation to which the script iscontainer-bound, ornull if there is noactive presentation. |
get | Ui | Returns an instance of the presentation's user-interface environment that allows the script toadd features like menus, dialogs, and sidebars. |
new | Affine | Returns a newAffine to build anAffine. |
open | Presentation | Opens thePresentation with the given ID. |
open | Presentation | Opens thePresentation with the given URL. |
Detailed documentation
create(name)
Creates and opens a newPresentation.
Parameters
| Name | Type | Description |
|---|---|---|
name | String | The 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, useopen instead.
// Get the current presentation to which this script is bound.constpresentation=SlidesApp.getActivePresentation();
Return
Presentation|null
Authorization
Scripts that use this method require authorization with one or more of the followingscopes:
https://www.googleapis.com/auth/presentations.currentonlyhttps://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
newAffineTransformBuilder()
Returns a newAffine to build anAffine. The builderis preset with the identity affine transform.
Return
openById(id)
Opens thePresentation with the given ID.
// Open a presentation by ID.constpresentation=SlidesApp.openById('docId');
Parameters
| Name | Type | Description |
|---|---|---|
id | String |
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',);
Parameters
| Name | Type | Description |
|---|---|---|
url | String |
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.