Presentations: fetch, create, batchUpdate, pages and thumbnails, and helpers for the common edits (outline, add a text slide, find and replace, fill a template).

Scopes. get-presentation, get-page, get-thumbnail and outline use presentations.readonly; everything else presentations. drive.file works for presentations the app created or the user opened with it. Copying a template, moving, sharing, exporting (PDF, PowerPoint) and deleting a presentation are Drive calls (google-drive).

Functions

add-text-slide

fn (presentation-id: Str, title: Str, body: Str): Map
fn (presentation-id: Str, title: Str, body: Str, opts: Map): Map

Add a title-and-body slide, at the end unless opts.insertionIndex. Returns {slide, title, body}, the new object ids, for further edits. Scope: presentations (or drive.file).

Example

ids ::google::slides::presentations/add-text-slide("1AbCdEf", "Highlights", "Revenue up 12%")
ids.body

// As the second slide
::google::slides::presentations/add-text-slide("1AbCdEf", "Agenda", "Intro\nDemo", {insertionIndex: 1})

batch-update

fn (presentation-id: Str, requests: Vec): Map
fn (presentation-id: Str, requests: Vec, opts: Map): Map

POST /{id}:batchUpdate - apply a Vec of requests atomically, in order: if one is invalid, none apply. Returns {presentationId, replies, writeControl}. Later requests can use object ids chosen in earlier ones. ::google::slides::requests builds requests; any request as a plain Map works too. Scope: presentations (or drive.file).

Example

::req ::google::slides::requests

reply ::google::slides::presentations/batch-update("1AbCdEf", [
  ::req/replace-all-text("2025", "2026"),
  ::req/delete-object("old_slide")
])
reply.replies[0].replaceAllText.occurrencesChanged

// Fails instead of applying if someone edited the deck first
::google::slides::presentations/batch-update("1AbCdEf", [::req/delete-object("old_slide")], {
  writeControl: {requiredRevisionId: "AOV_f4..."}
})

batch-update-body

fn (requests: Vec, opts: Map): Map

The batchUpdate body (pure): {requests} plus writeControl from opts when set ({requiredRevisionId} fails the write if the presentation changed).

Example

::google::slides::presentations/batch-update-body([{deleteObject: {objectId: "s1"}}], {writeControl: {requiredRevisionId: "r1"}})
// {requests: [{deleteObject: {objectId: "s1"}}], writeControl: {requiredRevisionId: "r1"}}

::google::slides::presentations/batch-update-body([], {})  // {requests: []}

build-presentation

fn (title: Str, opts: Map): Map

The presentations.create body (pure): {title} plus presentationId (choose the id), locale and pageSize from opts when set.

Example

::google::slides::presentations/build-presentation("Q3 review", {locale: "en"})  // {title: "Q3 review", locale: "en"}
::google::slides::presentations/build-presentation("Q3 review", {token: "ya29.abc"})  // {title: "Q3 review"}

create-presentation

fn (title: Str): Map
fn (title: Str, opts: Map): Map

POST /v1/presentations - create a presentation with one title slide. Returns the resource with presentationId. It lands in the authenticated user's My Drive root (move it with google-drive's move-file); a service account without domain-wide delegation owns it alone, so share it before anyone else can open it. Scope: presentations (or drive.file).

Example

deck ::google::slides::presentations/create-presentation("Q3 review")
deck.presentationId

// Choose the id
::google::slides::presentations/create-presentation("Q3 review", {presentationId: "q3-review-2026"})

fill-template

fn (presentation-id: Str, values: Map): Map
fn (presentation-id: Str, values: Map, opts: Map): Map

Replace each {{key}} in the presentation with its value from values (values are converted with Str; null values are skipped). The usual template flow is google-drive's copy-file, then this on the copy. Scope: presentations (or drive.file).

Example

// The deck contains {{name}} and {{quarter}}
reply ::google::slides::presentations/fill-template("1AbCdEf", {name: "Ada", quarter: "Q3"})
length(reply.replies)

// Only on one slide
::google::slides::presentations/fill-template("1AbCdEf", {name: "Ada"}, {pageObjectIds: ["p1"]})

get-page

fn (presentation-id: Str, page-id: Str): Map
fn (presentation-id: Str, page-id: Str, opts: Map): Map

GET /{id}/pages/{pageId} - one slide, layout or master. Scope: presentations.readonly.

Example

page ::google::slides::presentations/get-page("1AbCdEf", "p1")
::google::slides::content/slide-text(page)

// Only the fields you need
::google::slides::presentations/get-page("1AbCdEf", "p1", {fields: "pageElements.objectId"})

get-presentation

fn (presentation-id: Str): Map
fn (presentation-id: Str, opts: Map): Map

GET /{id} - the presentation: presentationId, title, pageSize, slides, masters, layouts, revisionId. Pass fields to trim the response. Scope: presentations.readonly.

Example

deck ::google::slides::presentations/get-presentation("1AbCdEf")
length(deck.slides)

// Only the fields you need
::google::slides::presentations/get-presentation("1AbCdEf", {fields: "title,slides.objectId"})

get-thumbnail

fn (presentation-id: Str, page-id: Str): Map
fn (presentation-id: Str, page-id: Str, opts: Map): Map

GET /{id}/pages/{pageId}/thumbnail - {contentUrl, width, height} for a rendered image of a page. contentUrl is short-lived (about 30 minutes) and needs no credentials. Counts against the expensive-read quota. Scope: presentations.readonly.

Example

thumb ::google::slides::presentations/get-thumbnail("1AbCdEf", "p1")
thumb.contentUrl

::google::slides::presentations/get-thumbnail("1AbCdEf", "p1", {mimeType: "PNG", thumbnailSize: "LARGE"})

outline

fn (presentation-id: Str): Vec
fn (presentation-id: Str, opts: Map): Vec

Every slide as {id, title, text, notes}; see ::google::slides::content/outline. Scope: presentations.readonly.

Example

slides ::google::slides::presentations/outline("1AbCdEf")
map(slides, %.title)

// With an explicit token
::google::slides::presentations/outline("1AbCdEf", {token: "ya29.abc"})

replace-text

fn (presentation-id: Str, search: Str, replacement: Str): Map
fn (presentation-id: Str, search: Str, replacement: Str, opts: Map): Map

Replace every occurrence of search with replacement, on every page unless {pageObjectIds: [...]}. Case-sensitive unless {matchCase: false}. The reply's replaceAllText.occurrencesChanged is the count. Scope: presentations (or drive.file).

Example

reply ::google::slides::presentations/replace-text("1AbCdEf", "2025", "2026")
reply.replies[0].replaceAllText.occurrencesChanged

// Case-insensitive, on one slide
::google::slides::presentations/replace-text("1AbCdEf", "acme", "Hot", {matchCase: false, pageObjectIds: ["p1"]})

text-slide-requests

fn (title: Str, body: Str, ids: Map, opts: Map): Vec

The requests add-text-slide sends (pure): a TITLE_AND_BODY slide with ids in ids ({slide, title, body}), then its title and body text. opts.insertionIndex places the slide.

Example

ids {slide: "slide1", title: "title1", body: "body1"}
requests ::google::slides::presentations/text-slide-requests("Agenda", "Intro", ids, {insertionIndex: 1})
requests[0].createSlide.insertionIndex  // 1
requests[1]  // {insertText: {objectId: "title1", text: "Agenda"}}

thumbnail-params

fn (opts: Map): Map

The query parameters get-thumbnail sends (pure), from opts.mimeType (PNG) and opts.thumbnailSize (SMALL, MEDIUM, LARGE).

Example

::google::slides::presentations/thumbnail-params({mimeType: "PNG", thumbnailSize: "LARGE"})
// {"thumbnailProperties.mimeType": "PNG", "thumbnailProperties.thumbnailSize": "LARGE"}

::google::slides::presentations/thumbnail-params({})  // {}