Skip to contents

An R6 class to represent and manipulate Google Slides presentations.

Public fields

title

The title of the presentation

presentation_id

The Google Slides presentation ID

page_size

Dimensions of slides (height and width in PTs)

revision_id

The current revision ID from Google Drive

locale

The presentation locale (e.g., "en")

masters

List of master slide metadata

layouts

List of layout slide metadata

last_refreshed

Timestamp of last refresh from API

Methods


presentation$new()

Create or open a presentation

Usage

presentation$new(id = NULL, title = "Untitled Presentation", set_active = TRUE)

Arguments

id

Presentation ID, URL, name, or NULL to create new

title

Title for new presentation (only used if id is NULL)

set_active

Whether to make this the active presentation

Returns

A new presentation object


presentation$refresh()

Refresh presentation data from Google Slides API

Usage

presentation$refresh()

Returns

Self, invisibly (for method chaining)


presentation$get_page_raw()

Get raw page data for a slide, with 15-second TTL caching.

Calls the slides.presentations.pages.get endpoint and caches the result per slide ID with a 15-second time-to-live. Repeated calls within the TTL return the cached value without an HTTP request. The cache is keyed by slide_id, so different slides are cached independently. Calling $refresh() clears all cached page data so the next call always re-fetches.

Usage

presentation$get_page_raw(slide_id, force = FALSE)

Arguments

slide_id

A single character string: the slide's object ID.

force

Logical. If TRUE, bypasses the TTL cache and always fetches from the API. Defaults to FALSE.

Returns

A named list: the raw page response from slides.presentations.pages.get.


presentation$delete()

Delete the presentation from Google Drive

Usage

presentation$delete()

Returns

NULL, invisibly


presentation$copy()

Create a copy of the presentation

Usage

presentation$copy(name = NULL)

Arguments

name

Name for the copy (defaults to "Copy of original_name")

Returns

A new presentation object for the copy


presentation$get_slide_by_index()

Get slide object from the presentation

Usage

presentation$get_slide_by_index(index)

Arguments

index

Index of the slide to return (1-based)

Returns

A slide object


presentation$get_slide_by_id()

Get slide object from the presentation

Usage

presentation$get_slide_by_id(slide_id)

Arguments

slide_id

ID of the slide to return

Returns

A slide object


presentation$get_slide_index()

Get the position of a slide in the presentation

Usage

presentation$get_slide_index(slide)

Arguments

slide

A slide object

Returns

Index of the slide


presentation$get_slide_ids()

Get slide IDs from the presentation

Usage

presentation$get_slide_ids()

Returns

Character vector of slide object IDs


presentation$get_slide_notes_text()

Get the speaker notes text for a slide. Does not refresh; caller is responsible for refreshing first.

Usage

presentation$get_slide_notes_text(slide_id)

Arguments

slide_id

ID of the slide

Returns

A single character string (empty string if no notes)


presentation$set_active()

Set this presentation as the active one

Usage

presentation$set_active()

Returns

Self, invisibly (for method chaining)


presentation$set_not_active()

Set this presentation to not active

Usage

presentation$set_not_active()

Returns

Self, invisibly (for method chaining)


presentation$is_active()

Check if this is the active presentation

Usage

presentation$is_active()

Returns

Logical


presentation$get_url()

Get the Google Slides URL for this presentation

Usage

presentation$get_url()

Returns

Character URL or NULL


presentation$browse()

Open the presentation in a browser

Usage

presentation$browse()

Returns

Self, invisibly (for method chaining) Get elements from the presentation


presentation$get_elements()

Filter the elements you have constructed to return a list of elements

Usage

presentation$get_elements(
  modified_since = NULL,
  modified_end = NULL,
  created_since = NULL,
  created_end = NULL,
  element_type = NULL,
  element_text = NULL,
  show_deleted = FALSE
)

Arguments

modified_since

Optional. Only return elements modified since this time

modified_end

Optional. Only return elements modified before this time

created_since

Optional. Only return elements created since this time

created_end

Optional. Only return elements created before this time

element_type

Optional. Only return elements of this type

element_text

Optional. Only return elements with this text

show_deleted

Optional. Show deleted elements

Returns

List of elements


presentation$add_to_ledger()

Add an element to the ledger

Usage

presentation$add_to_ledger(element_id, slide_id, element_type, element_text)

Arguments

element_id

Element ID

slide_id

Slide ID

element_type

Element type

element_text

Element text

Returns

Self


presentation$print()

Print method for presentation objects

Usage

presentation$print(...)

Arguments

...

Additional arguments (unused)