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
Property | Type | Description |
---|---|---|
AlignmentPosition | AlignmentPosition | An enumeration of the types of alignment positions. |
ArrowStyle | ArrowStyle | An enumeration of the different arrow styles that a Line can have. |
AutoTextType | AutoTextType | An enumeration of the types of auto text. |
AutofitType | AutofitType | An enumeration of autofit types. |
CellMergeState | CellMergeState | An enumeration of the different merge states of a table cell. |
ColorType | ColorType | An enumeration of color types. |
ContentAlignment | ContentAlignment | An enumeration of values used to specify content alignment. |
DashStyle | DashStyle | An enumeration of the different dash styles that a Line can have. |
FillType | FillType | An enumeration of fill types. |
LineCategory | LineCategory | An enumeration of the categories of Line . |
LineFillType | LineFillType | An enumeration of the types of LineFill . |
LineType | LineType | An enumeration of the types of Line . |
LinkType | LinkType | An enumeration of the types of links. |
ListPreset | ListPreset | An enumeration of the types of list presets. |
PageBackgroundType | PageBackgroundType | An enumeration of the types of page backgrounds. |
PageElementType | PageElementType | An enumeration of the types of page elements. |
PageType | PageType | An enumeration of the types of pages. |
ParagraphAlignment | ParagraphAlignment | An enumeration of the types of paragraph alignment. |
PlaceholderType | PlaceholderType | An enumeration of the types of placeholders. |
PredefinedLayout | PredefinedLayout | An enumeration of the predefined layouts. |
SelectionType | SelectionType | An enumeration of the types of selections. |
ShapeType | ShapeType | An enumeration of the types of shapes. |
SheetsChartEmbedType | SheetsChartEmbedType | An enumeration of Sheets chart embed types. |
SlideLinkingMode | SlideLinkingMode | An enumeration of the ways Slides can be linked. |
SlidePosition | SlidePosition | An enumeration of the types of slide positions. |
SpacingMode | SpacingMode | An enumeration of the types of spacing modes. |
TextBaselineOffset | TextBaselineOffset | An enumeration of the types of text baseline offset. |
TextDirection | TextDirection | An enumeration of the types of text directions. |
ThemeColorType | ThemeColorType | An enumeration of theme colors. |
VideoSourceType | VideoSourceType | An enumeration of the types of video source. |
Methods
Method | Return type | Brief description |
---|---|---|
create(name) | Presentation | Creates and opens a new Presentation . |
getActivePresentation() | Presentation | Returns the currently active presentation to which the script is container-bound, or null if there is no
active presentation. |
getUi() | Ui | Returns an instance of the presentation's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. |
newAffineTransformBuilder() | AffineTransformBuilder | Returns a new AffineTransformBuilder to build an AffineTransform . |
openById(id) | Presentation | Opens the Presentation with the given ID. |
openByUrl(url) | 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 openById(id)
instead.
// Get the current presentation to which this script is bound. var 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 AffineTransformBuilder
to build an AffineTransform
. The builder
is preset with the identity affine transform.
Return
openById(id)
Opens the Presentation
with the given ID.
// Open a presentation by ID. var 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. var 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