apps-script-utils 2.1.1 Help

getSlideByIndex

function getSlideByIndex( index: number, presentation?: GoogleAppsScript.Slides.Presentation | null ): GoogleAppsScript.Slides.Slide | null;

The index counts from zero. A position past the end gives null rather than an exception, which is what a loop over a deck that someone may be editing needs.

The index comes first and the presentation is optional, the way getSheetByIndex reads: without one the active presentation is used, which is what a script bound to a deck already has. A standalone script has none, and then the answer is null rather than an error.

Parameters

Parameter

Type

Description

index

number

The zero-based position of the slide.

presentation (optional)

GoogleAppsScript.Slides.Presentation \| null

The presentation to look in. Without it the active presentation is used.

Returns

GoogleAppsScript.Slides.Slide | null — the slide, or null when the index is past the end.

Examples

In the active presentation

// A script bound to a deck needs no presentation. const first = getSlideByIndex(0); // Elsewhere, name one. const third = getSlideByIndex(2, SlidesApp.openById(id));

See also

Source

src/appsscript/slide/getSlideByIndex.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.