SlidesApp

Creates and opens `https://developers.google.com/apps-script/reference/slides/presentation` that can be edited.

```javascript
// 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 |
|---|---|---|
| `AlignmentPosition` | `https://developers.google.com/apps-script/reference/slides/alignment-position` | An enumeration of the types of alignment positions. |
| `ArrowStyle` | `https://developers.google.com/apps-script/reference/slides/arrow-style` | An enumeration of the different arrow styles that a `https://developers.google.com/apps-script/reference/slides/line` can have. |
| `AutoTextType` | `https://developers.google.com/apps-script/reference/slides/auto-text-type` | An enumeration of the types of auto text. |
| `AutofitType` | `https://developers.google.com/apps-script/reference/slides/autofit-type` | An enumeration of autofit types. |
| `CellMergeState` | `https://developers.google.com/apps-script/reference/slides/cell-merge-state` | An enumeration of the different merge states of a table cell. |
| `ColorType` | `https://developers.google.com/apps-script/reference/base/color-type.html` | An enumeration of color types. |
| `ContentAlignment` | `https://developers.google.com/apps-script/reference/slides/content-alignment` | An enumeration of values used to specify content alignment. |
| `DashStyle` | `https://developers.google.com/apps-script/reference/slides/dash-style` | An enumeration of the different dash styles that a `https://developers.google.com/apps-script/reference/slides/line` can have. |
| `FillType` | `https://developers.google.com/apps-script/reference/slides/fill-type` | An enumeration of fill types. |
| `LineCategory` | `https://developers.google.com/apps-script/reference/slides/line-category` | An enumeration of the categories of `https://developers.google.com/apps-script/reference/slides/line`. |
| `LineFillType` | `https://developers.google.com/apps-script/reference/slides/line-fill-type` | An enumeration of the types of `https://developers.google.com/apps-script/reference/slides/line-fill`. |
| `LineType` | `https://developers.google.com/apps-script/reference/slides/line-type` | An enumeration of the types of `https://developers.google.com/apps-script/reference/slides/line`. |
| `LinkType` | `https://developers.google.com/apps-script/reference/slides/link-type` | An enumeration of the types of links. |
| `ListPreset` | `https://developers.google.com/apps-script/reference/slides/list-preset` | An enumeration of the types of list presets. |
| `PageBackgroundType` | `https://developers.google.com/apps-script/reference/slides/page-background-type` | An enumeration of the types of page backgrounds. |
| `PageElementType` | `https://developers.google.com/apps-script/reference/slides/page-element-type` | An enumeration of the types of page elements. |
| `PageType` | `https://developers.google.com/apps-script/reference/slides/page-type` | An enumeration of the types of pages. |
| `ParagraphAlignment` | `https://developers.google.com/apps-script/reference/slides/paragraph-alignment` | An enumeration of the types of paragraph alignment. |
| `PlaceholderType` | `https://developers.google.com/apps-script/reference/slides/placeholder-type` | An enumeration of the types of placeholders. |
| `PredefinedLayout` | `https://developers.google.com/apps-script/reference/slides/predefined-layout` | An enumeration of the predefined layouts. |
| `SelectionType` | `https://developers.google.com/apps-script/reference/slides/selection-type` | An enumeration of the types of selections. |
| `ShapeType` | `https://developers.google.com/apps-script/reference/slides/shape-type` | An enumeration of the types of shapes. |
| `SheetsChartEmbedType` | `https://developers.google.com/apps-script/reference/slides/sheets-chart-embed-type` | An enumeration of Sheets chart embed types. |
| `SlideLinkingMode` | `https://developers.google.com/apps-script/reference/slides/slide-linking-mode` | An enumeration of the ways Slides can be linked. |
| `SlidePosition` | `https://developers.google.com/apps-script/reference/slides/slide-position` | An enumeration of the types of slide positions. |
| `SpacingMode` | `https://developers.google.com/apps-script/reference/slides/spacing-mode` | An enumeration of the types of spacing modes. |
| `TextBaselineOffset` | `https://developers.google.com/apps-script/reference/slides/text-baseline-offset` | An enumeration of the types of text baseline offset. |
| `TextDirection` | `https://developers.google.com/apps-script/reference/slides/text-direction` | An enumeration of the types of text directions. |
| `ThemeColorType` | `https://developers.google.com/apps-script/reference/slides/theme-color-type` | An enumeration of theme colors. |
| `VideoSourceType` | `https://developers.google.com/apps-script/reference/slides/video-source-type` | An enumeration of the types of video source. |

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/slides/slides-app#create(String)` | `https://developers.google.com/apps-script/reference/slides/presentation` | Creates and opens a new `https://developers.google.com/apps-script/reference/slides/presentation`. |
| `https://developers.google.com/apps-script/reference/slides/slides-app#getActivePresentation()` | `https://developers.google.com/apps-script/reference/slides/presentation|null` | Returns the currently active presentation to which the script is [container-bound](https://developers.google.com/apps-script/scripts_containers), or `null` if there is no active presentation. |
| `https://developers.google.com/apps-script/reference/slides/slides-app#getUi()` | `https://developers.google.com/apps-script/reference/base/ui.html` | Returns an instance of the presentation's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. |
| `https://developers.google.com/apps-script/reference/slides/slides-app#newAffineTransformBuilder()` | `https://developers.google.com/apps-script/reference/slides/affine-transform-builder` | Returns a new `https://developers.google.com/apps-script/reference/slides/affine-transform-builder` to build an `https://developers.google.com/apps-script/reference/slides/affine-transform`. |
| `https://developers.google.com/apps-script/reference/slides/slides-app#openById(String)` | `https://developers.google.com/apps-script/reference/slides/presentation` | Opens the `https://developers.google.com/apps-script/reference/slides/presentation` with the given ID. |
| `https://developers.google.com/apps-script/reference/slides/slides-app#openByUrl(String)` | `https://developers.google.com/apps-script/reference/slides/presentation` | Opens the `https://developers.google.com/apps-script/reference/slides/presentation` with the given URL. |

## Detailed documentation

### `create(name)`

Creates and opens a new `https://developers.google.com/apps-script/reference/slides/presentation`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `name` | `String` | The name to be given to the created presentation. |

#### Return


`https://developers.google.com/apps-script/reference/slides/presentation` --- The presentation with the given name.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `getActivePresentation()`

Returns the currently active presentation to which the script is [container-bound](https://developers.google.com/apps-script/scripts_containers), or `null` if there is no
active presentation. To interact with a presentation to which the script is not
container-bound, use `https://developers.google.com/apps-script/reference/slides/slides-app#openById(String)` instead.

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

#### Return


`https://developers.google.com/apps-script/reference/slides/presentation|null`

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_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](https://developers.google.com/apps-script/scripts_containers) to the presentation. For more information, see
the guides to [menus](https://developers.google.com/apps-script/guides/menus) and [dialogs and sidebars](https://developers.google.com/apps-script/guides/dialogs).

```javascript
// 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


`https://developers.google.com/apps-script/reference/base/ui.html`

*** ** * ** ***

### `newAffineTransformBuilder()`

Returns a new `https://developers.google.com/apps-script/reference/slides/affine-transform-builder` to build an `https://developers.google.com/apps-script/reference/slides/affine-transform`. The builder

#### Return


`https://developers.google.com/apps-script/reference/slides/affine-transform-builder` --- A new `https://developers.google.com/apps-script/reference/slides/affine-transform-builder`.

*** ** * ** ***

### `openById(id)`

Opens the `https://developers.google.com/apps-script/reference/slides/presentation` with the given ID.

```javascript
// Open a presentation by ID.
const presentation = SlidesApp.openById('docId');
```
If the presentation is already open, the same presentation instance is returned.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `id` | `String` | The ID of the presentation to open. |

#### Return


`https://developers.google.com/apps-script/reference/slides/presentation` --- The presentation with the given ID.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/presentations`

*** ** * ** ***

### `openByUrl(url)`

Opens the `https://developers.google.com/apps-script/reference/slides/presentation` with the given URL.

```javascript
// Open a presentation by URL.
const presentation = SlidesApp.openByUrl(
    'https://docs.google.com/presentation/d/docId/edit',
);
```
If the presentation is already open, the same presentation instance is returned.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `url` | `String` | The URL of the presentation to open. |

#### Return


`https://developers.google.com/apps-script/reference/slides/presentation` --- The presentation with the given URL.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/presentations`