Class Presentation Stay organized with collections Save and categorize content based on your preferences.
Page Summary
You can add and remove editors and viewers to a presentation using various methods.
Slides can be appended to or inserted into a presentation with different layouts or by copying existing slides.
Information about the presentation, such as its ID, name, layouts, masters, and page dimensions, can be retrieved using specific methods.
You can get the current user's selection within an active presentation and find specific page elements or slides by their ID.
Text within the presentation can be replaced, and the presentation can be saved and closed.
A presentation.
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Presentation | Adds the given user to the list of editors for thePresentation. |
add | Presentation | Adds the given user to the list of editors for thePresentation. |
add | Presentation | Adds the given array of users to the list of editors for thePresentation. |
add | Presentation | Adds the given user to the list of viewers for thePresentation. |
add | Presentation | Adds the given user to the list of viewers for thePresentation. |
add | Presentation | Adds the given array of users to the list of viewers for thePresentation. |
append | Slide | Appends a slide to the end of the presentation using thePredefinedpredefined layout based on the current master. |
append | Slide | Appends a slide to the end of the presentation using the specified layout based on the currentmaster. |
append | Slide | Appends a slide to the end of the presentation using the specified predefined layout based onthe current master. |
append | Slide | Appends a copy of the providedSlide to the end of the presentation. |
append | Slide | Appends a copy of the providedSlide from the source presentation to the end of thecurrent presentation, and sets the slide link as specified by theSlide. |
get | User[] | Gets the list of editors for thisPresentation. |
get | String | Gets the presentation's unique identifier. |
get | Layout[] | Gets the layouts in the presentation. |
get | Master[] | Gets the masters in the presentation. |
get | String | Gets the name or title of the presentation. |
get | Notes | Gets the notes master of the presentation. |
get | Number | Gets the page height of the notes master and notes pages in the presentation in points. |
get | Number | Gets the page width of the notes master and notes pages in the presentation in points. |
get | Page | Returns thePage with the given ID, ornull if none exists. |
get | Number | Gets the page height of the slides, layouts, and masters in the presentation in points. |
get | Number | Gets the page width of the slides, layouts, and masters in the presentation in points. |
get | Selection|null | Gets the user’s selection in the active presentation. |
get | Slide|null | Returns theSlide with the given ID, ornull if none exists. |
get | Slide[] | Gets the slides in the presentation. |
get | String | Retrieves the URL to access this presentation. |
get | User[] | Gets the list of viewers and commenters for thisPresentation. |
insert | Slide | Inserts a slide at the specified index in the presentation using thePredefined predefined layout based on the current master. |
insert | Slide | Inserts a slide at the specified index in the presentation using the specified layout based onthe current master. |
insert | Slide | Inserts a slide at the specified index in the presentation using the specified predefinedlayout based on the current master. |
insert | Slide | Inserts a copy of the providedSlide at the specified index in the presentation. |
insert | Slide | Inserts a copy of the providedSlide from the source presentation into the specifiedindex in the current presentation, and sets the slide link as specified by theSlide. |
remove | Presentation | Removes the given user from the list of editors for thePresentation. |
remove | Presentation | Removes the given user from the list of editors for thePresentation. |
remove | Presentation | Removes the given user from the list of viewers and commenters for thePresentation. |
remove | Presentation | Removes the given user from the list of viewers and commenters for thePresentation. |
replace | Integer | Replaces all instances of text matching find text with replace text. |
replace | Integer | Replaces all instances of text matching find text with replace text. |
save | void | Saves the currentPresentation. |
set | void | Sets the name or title of the presentation. |
Detailed documentation
addEditor(emailAddress)
Adds the given user to the list of editors for thePresentation. If the user was alreadyon the list of viewers, this method promotes the user out of the list of viewers.
Parameters
| Name | Type | Description |
|---|---|---|
email | String | The email address of the user to add. |
Return
Presentation — ThisPresentation, for chaining.
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
addEditor(user)
Adds the given user to the list of editors for thePresentation. If the user was alreadyon the list of viewers, this method promotes the user out of the list of viewers.
Parameters
| Name | Type | Description |
|---|---|---|
user | User | A representation of the user to add. |
Return
Presentation — ThisPresentation, for chaining.
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
addEditors(emailAddresses)
Adds the given array of users to the list of editors for thePresentation. If any of theusers were already on the list of viewers, this method promotes them out of the list ofviewers.
Parameters
| Name | Type | Description |
|---|---|---|
email | String[] | An array of email addresses of the users to add. |
Return
Presentation — ThisPresentation, for chaining.
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
addViewer(emailAddress)
Adds the given user to the list of viewers for thePresentation. If the user was alreadyon the list of editors, this method has no effect.
Parameters
| Name | Type | Description |
|---|---|---|
email | String | The email address of the user to add. |
Return
Presentation — ThisPresentation, for chaining.
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
addViewer(user)
Adds the given user to the list of viewers for thePresentation. If the user was alreadyon the list of editors, this method has no effect.
Parameters
| Name | Type | Description |
|---|---|---|
user | User | A representation of the user to add. |
Return
Presentation — ThisPresentation, for chaining.
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
addViewers(emailAddresses)
Adds the given array of users to the list of viewers for thePresentation. If any of theusers were already on the list of editors, this method has no effect for them.
Parameters
| Name | Type | Description |
|---|---|---|
email | String[] | An array of email addresses of the users to add. |
Return
Presentation — ThisPresentation, for chaining.
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
appendSlide()
Appends a slide to the end of the presentation using thePredefinedpredefined layout based on the current master. The current master is one of the following:
- The master of the current last slide.
- The first master in the presentation, if there is no slide.
Return
Slide — The new slide that is appended.
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
appendSlide(layout)
Appends a slide to the end of the presentation using the specified layout based on the currentmaster. The current master is one of the following:
- The master of the current last slide.
- The first master in the presentation, if there is no slide.
Parameters
| Name | Type | Description |
|---|---|---|
layout | Layout | The layout to use for the new slide; it should be present in the current master. |
Return
Slide — The new slide that is appended.
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
appendSlide(predefinedLayout)
Appends a slide to the end of the presentation using the specified predefined layout based onthe current master. The current master is one of the following:
- The master of the current last slide.
- The first master in the presentation, if there is no slide.
Parameters
| Name | Type | Description |
|---|---|---|
predefined | Predefined | The predefined layout to use for the new slide; it should be present in the current master. |
Return
Slide — The new slide that is appended.
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
appendSlide(slide)
Appends a copy of the providedSlide to the end of the presentation.
If the slide being copied is from a different presentation, the parent master and layoutpages are copied as well if they do not already exist in this presentation.
// Copy a slide from another presentation and appends it.constotherPresentation=SlidesApp.openById('presentationId');constcurrentPresentation=SlidesApp.getActivePresentation();constslide=otherPresentation.getSlides()[0];currentPresentation.appendSlide(slide);
Parameters
| Name | Type | Description |
|---|---|---|
slide | Slide | The slide to be copied and appended. |
Return
Slide — The new slide that is appended.
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
appendSlide(slide, linkingMode)
Appends a copy of the providedSlide from the source presentation to the end of thecurrent presentation, and sets the slide link as specified by theSlide.
If the slide being copied is from a different presentation, the parent master and layoutpages are copied as well if they do not already exist in the current presentation.
If the link mode isSlide, the appended slide can be updated tomatch the provided source slide whenSlide.refreshSlide() is called. Other collaboratorscan see the link to the source slide.Slide cannot be used withsource slides from the current presentation.
// Copy a slide from another presentation, then append and link it.constsourcePresentation=SlidesApp.openById('presentationId');constcurrentPresentation=SlidesApp.getActivePresentation();constslide=sourcePresentation.getSlides()[0];constappendedSlide=currentPresentation.appendSlide(slide,SlidesApp.SlideLinkingMode.LINKED,);
Parameters
| Name | Type | Description |
|---|---|---|
slide | Slide | The slide to be copied, appended, and linked. |
linking | Slide | The link mode to use. |
Return
Slide — The new slide.
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
getEditors()
Gets the list of editors for thisPresentation.
Return
User[] — An array of users with edit permission.
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
getId()
Gets the presentation's unique identifier. The presentation ID is used withSlides to open a specific presentation instance.
Return
String — The ID of this presentation.
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
getLayouts()
Gets the layouts in the presentation.
Return
Layout[] — The list of layouts in this presentation.
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
getMasters()
Gets the masters in the presentation.
Return
Master[] — The list of masters in this presentation.
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
getName()
Gets the name or title of the presentation.
Return
String — The title of this presentation.
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
getNotesMaster()
Gets the notes master of the presentation.
Return
Notes — The notes master of the presentation.
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
getNotesPageHeight()
Gets the page height of the notes master and notes pages in the presentation in points. Theyall have the same page height.
Return
Number — The notes page height in points.
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
getNotesPageWidth()
Gets the page width of the notes master and notes pages in the presentation in points. They allhave the same page width.
Return
Number — The notes page width in points.
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
getPageElementById(id)
Returns thePage with the given ID, ornull if none exists.
Parameters
| Name | Type | Description |
|---|---|---|
id | String | The ID of the page element that is being retrieved. |
Return
Page — The page element 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.currentonlyhttps://www.googleapis.com/auth/presentations
getPageHeight()
Gets the page height of the slides, layouts, and masters in the presentation in points. Theyall have the same page height.
Return
Number — The page height in points.
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
getPageWidth()
Gets the page width of the slides, layouts, and masters in the presentation in points. They allhave the same page width.
Return
Number — The page width in points.
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
getSelection()
Gets the user’s selection in the active presentation. A script can only access the selection ofthe user who is running the script, and only if the script isbound to the presentation.
Note that the selection returned is the current effective selection. As the script performsvarious changes to the presentation, the selection is transformed to take them into account.For example if two shapes A and B are selected, and then the script removes shape B, thereturned selection object is implicitly updated such that only shape A is selected.
// Gets the current active page that is selected in the active presentation.constselection=SlidesApp.getActivePresentation().getSelection();constcurrentPage=selection.getCurrentPage();
Return
Selection|null — A representation of the user's selection, ornull if the script is not bound to the presentation or if there is no valid user selection.
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
getSlideById(id)
Returns theSlide with the given ID, ornull if none exists.
Parameters
| Name | Type | Description |
|---|---|---|
id | String | The ID of the slide that is being retrieved. |
Return
Slide|null — The slide 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.currentonlyhttps://www.googleapis.com/auth/presentations
getSlides()
getUrl()
Retrieves the URL to access this presentation.
constpresentation=SlidesApp.getActivePresentation();// Send out the link to open the presentation.MailApp.sendEmail('<email-address>',presentation.getName(),presentation.getUrl(),);
Return
String — The URL to access the current presentation.
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
getViewers()
Gets the list of viewers and commenters for thisPresentation.
Return
User[] — An array of users with view or comment permission.
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
insertSlide(insertionIndex)
Inserts a slide at the specified index in the presentation using thePredefined predefined layout based on the current master. The current master isone of the following:
- The master of the previous slide.
- The master of the first slide, if the insertionIndex is zero.
- The first master in the presentation, if there is no slide.
Parameters
| Name | Type | Description |
|---|---|---|
insertion | Integer | The zero-based index indicating where to insert the slide. |
Return
Slide — The new slide that is inserted.
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
insertSlide(insertionIndex, layout)
Inserts a slide at the specified index in the presentation using the specified layout based onthe current master. The current master is one of the following:
- The master of the previous slide.
- The master of the first slide, if the insertionIndex is zero.
- The first master in the presentation, if there is no slide.
Parameters
| Name | Type | Description |
|---|---|---|
insertion | Integer | The zero-based index indicating where to insert the slide. |
layout | Layout | The layout to use for the new slide; it should be present in the current master. |
Return
Slide — The new slide that is inserted.
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
insertSlide(insertionIndex, predefinedLayout)
Inserts a slide at the specified index in the presentation using the specified predefinedlayout based on the current master. The current master is one of the following:
- The master of the previous slide.
- The master of the first slide, if the insertionIndex is zero.
- The first master in the presentation, if there is no slide.
Parameters
| Name | Type | Description |
|---|---|---|
insertion | Integer | The zero-based index indicating where to insert the slide. |
predefined | Predefined | The predefined layout to use for the new slide; it should be present in the current master. |
Return
Slide — The new slide that is inserted.
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
insertSlide(insertionIndex, slide)
Inserts a copy of the providedSlide at the specified index in the presentation.
If the slide being copied is from a different presentation, the parent master and layoutpages are copied as well if they do not already exist in this presentation.
// Copy a slide from another presentation and inserts it.constotherPresentation=SlidesApp.openById('presentationId');constcurrentPresentation=SlidesApp.getActivePresentation();constslide=otherPresentation.getSlides()[0];constinsertionIndex=1;currentPresentation.insertSlide(insertionIndex,slide);
Parameters
| Name | Type | Description |
|---|---|---|
insertion | Integer | The zero-based index indicating where to insert the slide. |
slide | Slide | The slide to be copied and inserted. |
Return
Slide — The new slide that is inserted.
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
insertSlide(insertionIndex, slide, linkingMode)
Inserts a copy of the providedSlide from the source presentation into the specifiedindex in the current presentation, and sets the slide link as specified by theSlide.
If the slide being copied is from a different presentation, the parent master and layoutpages are copied as well if they do not already exist in the current presentation.
If the link mode isSlide, the inserted slide can be updated tomatch the provided source slide whenSlide.refreshSlide() is called. Other collaboratorscan see the link to the source slide.Slide cannot be used withsource slides from the current presentation.
// Copy a slide from another presentation, then insert and link it.constsourcePresentation=SlidesApp.openById('presentationId');constcurrentPresentation=SlidesApp.getActivePresentation();constslide=sourcePresentation.getSlides()[0];constinsertionIndex=1;constinsertedSlide=currentPresentation.insertSlide(insertionIndex,slide,SlidesApp.SlideLinkingMode.LINKED,);
Parameters
| Name | Type | Description |
|---|---|---|
insertion | Integer | The zero-based index indicating where to insert the slide. |
slide | Slide | The slide to be copied and inserted. |
linking | Slide | The link mode to use. |
Return
Slide — The new slide.
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
removeEditor(emailAddress)
Removes the given user from the list of editors for thePresentation. This method doesn'tblock users from accessing thePresentation if they belong to a class of users who havegeneral access—for example, if thePresentation is shared with the user's entiredomain, or if thePresentation is in a shared drive that the user can access.
For Drive files, this also removes the user from the list of viewers.
Parameters
| Name | Type | Description |
|---|---|---|
email | String | The email address of the user to remove. |
Return
Presentation — ThisPresentation, for chaining.
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
removeEditor(user)
Removes the given user from the list of editors for thePresentation. This method doesn'tblock users from accessing thePresentation if they belong to a class of users who havegeneral access—for example, if thePresentation is shared with the user's entiredomain, or if thePresentation is in a shared drive that the user can access.
For Drive files, this also removes the user from the list of viewers.
Parameters
| Name | Type | Description |
|---|---|---|
user | User | A representation of the user to remove. |
Return
Presentation — ThisPresentation, for chaining.
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
removeViewer(emailAddress)
Removes the given user from the list of viewers and commenters for thePresentation. Thismethod has no effect if the user is an editor, not a viewer or commenter. This method alsodoesn't block users from accessing thePresentation if they belong to a class of users whohave general access—for example, if thePresentation is shared with the user'sentire domain, or if thePresentation is in a shared drive that the user can access.
For Drive files, this also removes the user from the list of editors.
Parameters
| Name | Type | Description |
|---|---|---|
email | String | The email address of the user to remove. |
Return
Presentation — ThisPresentation for chaining.
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
removeViewer(user)
Removes the given user from the list of viewers and commenters for thePresentation. Thismethod has no effect if the user is an editor, not a viewer. This method also doesn't blockusers from accessing thePresentation if they belong to a class of users who have generalaccess—for example, if thePresentation is shared with the user's entire domain, orif thePresentation is in a shared drive that the user can access.
For Drive files, this also removes the user from the list of editors.
Parameters
| Name | Type | Description |
|---|---|---|
user | User | A representation of the user to remove. |
Return
Presentation — ThisPresentation for chaining.
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
replaceAllText(findText, replaceText)
Replaces all instances of text matching find text with replace text. The search is caseinsensitive.
Parameters
| Name | Type | Description |
|---|---|---|
find | String | The text to find. |
replace | String | The text to replace the matched text. |
Return
Integer — the number of occurrences changed
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
replaceAllText(findText, replaceText, matchCase)
Replaces all instances of text matching find text with replace text.
Parameters
| Name | Type | Description |
|---|---|---|
find | String | The text to find. |
replace | String | The text to replace the matched text. |
match | Boolean | Iftrue, the search is case sensitive; iffalse, the search is case insensitive. |
Return
Integer — the number of occurrences changed
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
saveAndClose()
Saves the currentPresentation. Causes pending updates to be flushed and applied.
Thesave method is automatically invoked at the end of script executionfor each openPresentation, even if the script execution terminated with an error.
A closedPresentation cannot be edited. Use one of the open methods onSlides to reopen a given presentation for editing.
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
setName(name)
Sets the name or title of the presentation.
Parameters
| Name | Type | Description |
|---|---|---|
name | String | The name to set for this presentation. |
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
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.