Creates and opens Presentations
that can be edited.
// Open a presentation by ID. let preso = 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 a Line 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 a Line can have. |
Fill | Fill | An enumeration of fill types. |
Line | Line | An enumeration of the categories of Line . |
Line | Line | An enumeration of the types of Line . |
Line | Line | An enumeration of the types of Line . |
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 new Presentation . |
get | Presentation | Returns the currently active presentation to which the script is container-bound, or null if there is no
active presentation. |
get | Ui | Returns an instance of the presentation's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. |
new | Affine | Returns a new Affine to build an Affine . |
open | Presentation | Opens the Presentation with the given ID. |
open | Presentation | Opens the Presentation with the given URL. |
Detailed documentation
create(name)
Creates and opens a new Presentation
.
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 following scopes:
-
https://www.googleapis.com/auth/presentations
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 open
instead.
// Get the current presentation to which this script is bound. const presentation = SlidesApp.getActivePresentation();
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
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 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
newAffineTransformBuilder()
Returns a new Affine
to build an Affine
. The builder
is preset with the identity affine transform.
Return
openById(id)
Opens the Presentation
with the given ID.
// Open a presentation by ID. const presentation = 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 following scopes:
-
https://www.googleapis.com/auth/presentations
openByUrl(url)
Opens the Presentation
with the given URL.
// Open a presentation by URL. const presentation = 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 following scopes:
-
https://www.googleapis.com/auth/presentations