Liking cljdoc? Tell your friends :D

goog.workspace.slides

Clojure wrapper for the Google Slides API (v1).

Provides idiomatic Clojure functions for creating, reading, and updating Google Slides presentations through the batchUpdate pattern.

Auth: use csl/scoped-delegated-credentials or csl/user-credentials with the appropriate scope:

  • SlidesScopes/PRESENTATIONS (full read/write)
  • SlidesScopes/PRESENTATIONS_READONLY (read-only)
  • SlidesScopes/DRIVE / DRIVE_FILE / DRIVE_READONLY (Slides files are Drive files)
  • SlidesScopes/SPREADSHEETS / SPREADSHEETS_READONLY (only required for embedded Sheets charts via CreateSheetsChartRequest / RefreshSheetsChartRequest)

All presentation mutations go through batch-update, which takes a vector of request maps (kebab-case keys, coerced to camelCase internally). Convenience builders (create-slide-request, insert-text-request, etc.) return plain Clojure maps for use with batch-update.

Enum-typed fields in request data maps should be passed as uppercase strings (e.g. "BLANK", "TITLE", "TITLE_AND_BODY" for predefined-layout).

All functions return {:data ...} on success or {:error ...} on failure.

Clojure wrapper for the Google Slides API (v1).

Provides idiomatic Clojure functions for creating, reading, and updating
Google Slides presentations through the batchUpdate pattern.

Auth: use csl/scoped-delegated-credentials or csl/user-credentials with
the appropriate scope:
- SlidesScopes/PRESENTATIONS          (full read/write)
- SlidesScopes/PRESENTATIONS_READONLY (read-only)
- SlidesScopes/DRIVE / DRIVE_FILE / DRIVE_READONLY (Slides files are Drive files)
- SlidesScopes/SPREADSHEETS / SPREADSHEETS_READONLY (only required for
  embedded Sheets charts via CreateSheetsChartRequest / RefreshSheetsChartRequest)

All presentation mutations go through batch-update, which takes a vector of
request maps (kebab-case keys, coerced to camelCase internally). Convenience
builders (create-slide-request, insert-text-request, etc.) return plain
Clojure maps for use with batch-update.

Enum-typed fields in request data maps should be passed as uppercase strings
(e.g. "BLANK", "TITLE", "TITLE_AND_BODY" for predefined-layout).

All functions return {:data ...} on success or {:error ...} on failure.
raw docstring

batch-updateclj

(batch-update client presentation-id requests & [opts])

Execute a batch of structural updates against a presentation.

requests — vector of request maps (kebab-case keys). Each map has a single top-level key naming the operation: {:create-slide {:object-id "s1" :slide-layout-reference {:predefined-layout "BLANK"}}} {:insert-text {:object-id "shape1" :text "Hello"}} {:delete-object {:object-id "obj1"}}

Use the convenience builders below or construct as plain data.

Returns {:data {:replies [...] :write-control {...}}} — one reply per request in the same order. Use :write-control on the next call for optimistic locking.

opts:

  • :write-control — map with :required-revision-id or :target-revision-id for optimistic locking
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Execute a batch of structural updates against a presentation.

requests — vector of request maps (kebab-case keys). Each map has a single
top-level key naming the operation:
  {:create-slide {:object-id "s1" :slide-layout-reference {:predefined-layout "BLANK"}}}
  {:insert-text  {:object-id "shape1" :text "Hello"}}
  {:delete-object {:object-id "obj1"}}

Use the convenience builders below or construct as plain data.

Returns {:data {:replies [...] :write-control {...}}} — one reply per request
in the same order. Use :write-control on the next call for optimistic locking.

opts:
- :write-control   — map with :required-revision-id or :target-revision-id
                     for optimistic locking
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-image-requestclj

(create-image-request url element-properties & [{:keys [object-id]}])

Insert an image into a slide.

url — public image URL accessible by Slides element-properties — placement

opts:

  • :object-id — caller-supplied object ID
Insert an image into a slide.

url                 — public image URL accessible by Slides
element-properties  — placement

opts:
- :object-id — caller-supplied object ID
raw docstring

create-line-requestclj

(create-line-request line-category
                     element-properties
                     &
                     [{:keys [object-id category]}])

Insert a line (or connector) into a slide.

line-category — "STRAIGHT" | "BENT" | "CURVED" element-properties — placement

opts:

  • :object-id — caller-supplied object ID
  • :category — "STRAIGHT" | "BENT" | "CURVED" — line shape category
Insert a line (or connector) into a slide.

line-category      — "STRAIGHT" | "BENT" | "CURVED"
element-properties — placement

opts:
- :object-id    — caller-supplied object ID
- :category     — "STRAIGHT" | "BENT" | "CURVED" — line shape category
raw docstring

create-paragraph-bullets-requestclj

(create-paragraph-bullets-request object-id
                                  text-range
                                  bullet-preset
                                  &
                                  [{:keys [cell-location]}])

Add bullet points to paragraphs in a range.

object-id — text-bearing element object ID text-range — range descriptor bullet-preset — "BULLET_DISC_CIRCLE_SQUARE" | "NUMBERED_DIGIT_ALPHA_ROMAN" | etc.

opts:

  • :cell-location — {:row-index :column-index} for table cells
Add bullet points to paragraphs in a range.

object-id  — text-bearing element object ID
text-range — range descriptor
bullet-preset — "BULLET_DISC_CIRCLE_SQUARE" | "NUMBERED_DIGIT_ALPHA_ROMAN" | etc.

opts:
- :cell-location — {:row-index :column-index} for table cells
raw docstring

create-presentationclj

(create-presentation client presentation & [opts])

Create a new (empty) presentation.

presentation — map with kebab-case keys. The only field accepted at creation time is :title; all structural content must be added via batch-update.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Create a new (empty) presentation.

presentation — map with kebab-case keys. The only field accepted at
creation time is :title; all structural content must be added via
batch-update.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

create-shape-requestclj

(create-shape-request shape-type element-properties & [{:keys [object-id]}])

Insert a shape into a slide.

shape-type — "TEXT_BOX" | "RECTANGLE" | "ELLIPSE" | etc. element-properties — {:page-object-id ... :size {...} :transform {...}}

opts:

  • :object-id — caller-supplied object ID for the shape
Insert a shape into a slide.

shape-type — "TEXT_BOX" | "RECTANGLE" | "ELLIPSE" | etc.
element-properties — {:page-object-id ... :size {...} :transform {...}}

opts:
- :object-id — caller-supplied object ID for the shape
raw docstring

create-sheets-chart-requestclj

(create-sheets-chart-request spreadsheet-id
                             chart-id
                             linking-mode
                             element-properties
                             &
                             [{:keys [object-id]}])

Embed a chart from a Google Sheets spreadsheet into a slide.

spreadsheet-id — source spreadsheet ID chart-id — int chart ID within the spreadsheet linking-mode — "LINKED" | "NOT_LINKED_IMAGE" element-properties — placement

opts:

  • :object-id — caller-supplied object ID
Embed a chart from a Google Sheets spreadsheet into a slide.

spreadsheet-id     — source spreadsheet ID
chart-id           — int chart ID within the spreadsheet
linking-mode       — "LINKED" | "NOT_LINKED_IMAGE"
element-properties — placement

opts:
- :object-id — caller-supplied object ID
raw docstring

create-slide-requestclj

(create-slide-request &
                      [{:keys [object-id insertion-index predefined-layout
                               placeholder-id-mappings]}])

Insert a new slide at the given position.

opts:

  • :object-id — caller-supplied object ID for the new slide
  • :insertion-index — int; position to insert (0-based). Omit to append.
  • :predefined-layout — layout name string, e.g. "BLANK", "TITLE", "TITLE_AND_BODY", "SECTION_HEADER"
  • :placeholder-id-mappings — vector of {:layout-placeholder {:type :index} :object-id "..."}
Insert a new slide at the given position.

opts:
- :object-id          — caller-supplied object ID for the new slide
- :insertion-index    — int; position to insert (0-based). Omit to append.
- :predefined-layout  — layout name string, e.g. "BLANK", "TITLE",
                        "TITLE_AND_BODY", "SECTION_HEADER"
- :placeholder-id-mappings — vector of {:layout-placeholder {:type :index}
                                         :object-id "..."}
raw docstring

create-table-requestclj

(create-table-request rows columns element-properties & [{:keys [object-id]}])

Insert a table into a slide.

rows / columns — int counts element-properties — placement (:page-object-id, :size, :transform)

opts:

  • :object-id — caller-supplied object ID
Insert a table into a slide.

rows / columns      — int counts
element-properties  — placement (:page-object-id, :size, :transform)

opts:
- :object-id — caller-supplied object ID
raw docstring

create-video-requestclj

(create-video-request source id element-properties & [{:keys [object-id]}])

Insert a video (YouTube or Drive) into a slide.

source — "YOUTUBE" | "DRIVE" id — video ID (YouTube ID or Drive file ID) element-properties — placement

opts:

  • :object-id — caller-supplied object ID
Insert a video (YouTube or Drive) into a slide.

source — "YOUTUBE" | "DRIVE"
id     — video ID (YouTube ID or Drive file ID)
element-properties — placement

opts:
- :object-id — caller-supplied object ID
raw docstring

delete-object-requestclj

(delete-object-request object-id)

Delete a page element, slide, group, or table cell content by object ID.

Delete a page element, slide, group, or table cell content by object ID.
raw docstring

delete-paragraph-bullets-requestclj

(delete-paragraph-bullets-request object-id
                                  text-range
                                  &
                                  [{:keys [cell-location]}])

Remove bullets from paragraphs in a range.

opts:

  • :cell-location — {:row-index :column-index} for table cells
Remove bullets from paragraphs in a range.

opts:
- :cell-location — {:row-index :column-index} for table cells
raw docstring

delete-table-column-requestclj

(delete-table-column-request table-object-id cell-location)

Delete the column containing the specified cell.

Delete the column containing the specified cell.
raw docstring

delete-table-row-requestclj

(delete-table-row-request table-object-id cell-location)

Delete the row containing the specified cell.

Delete the row containing the specified cell.
raw docstring

delete-text-requestclj

(delete-text-request object-id text-range & [{:keys [cell-location]}])

Delete a range of text from a shape or table cell.

object-id — text-bearing element object ID text-range — {:type "ALL"} or {:type "FIXED_RANGE" :start-index N :end-index N} or {:type "FROM_START_INDEX" :start-index N}

opts:

  • :cell-location — {:row-index :column-index} for table cells
Delete a range of text from a shape or table cell.

object-id     — text-bearing element object ID
text-range    — {:type "ALL"} or {:type "FIXED_RANGE" :start-index N :end-index N}
                or {:type "FROM_START_INDEX" :start-index N}

opts:
- :cell-location — {:row-index :column-index} for table cells
raw docstring

duplicate-object-requestclj

(duplicate-object-request object-id & [{:keys [object-ids]}])

Duplicate an object (slide or page element) by object ID.

opts:

  • :object-ids — map of original ID → new ID for chained duplication
Duplicate an object (slide or page element) by object ID.

opts:
- :object-ids — map of original ID → new ID for chained duplication
raw docstring

extract-slide-textclj

(extract-slide-text presentation)

Extract plain text from a presentation map returned by get-presentation.

Walks each slide's page-elements, collecting text from shapes (TextContent with TextElements/TextRun) and tables (recursing into cell text). Text from different elements is separated by newlines for readability.

Returns an empty string for presentations with no text content.

Extract plain text from a presentation map returned by get-presentation.

Walks each slide's page-elements, collecting text from shapes (TextContent
with TextElements/TextRun) and tables (recursing into cell text). Text from
different elements is separated by newlines for readability.

Returns an empty string for presentations with no text content.
raw docstring

get-pageclj

(get-page client presentation-id page-object-id & [opts])

Get a single page (slide / layout / master / notes) by object ID.

opts:

  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a single page (slide / layout / master / notes) by object ID.

opts:
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-page-thumbnailclj

(get-page-thumbnail client presentation-id page-object-id & [opts])

Get a thumbnail image URL for a page.

opts:

  • :mime-type — "PNG" (default if unset on the API side)
  • :thumbnail-size — "THUMBNAIL_SIZE_UNSPECIFIED" | "LARGE" | "MEDIUM" | "SMALL"
  • :fields — partial response field mask string
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a thumbnail image URL for a page.

opts:
- :mime-type       — "PNG" (default if unset on the API side)
- :thumbnail-size  — "THUMBNAIL_SIZE_UNSPECIFIED" | "LARGE" | "MEDIUM" | "SMALL"
- :fields          — partial response field mask string
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

get-presentationclj

(get-presentation client presentation-id & [opts])

Get a presentation by ID. Returns the full structure including all slides, page elements, and styles. Use extract-slide-text to pull plain text.

opts:

  • :fields — partial response field mask string. Omitting returns the entire presentation which can be megabytes for large decks — pass a narrow mask if possible.
  • :read-timeout-ms — int, override the HTTP client's default read timeout
Get a presentation by ID. Returns the full structure including all slides,
page elements, and styles. Use extract-slide-text to pull plain text.

opts:
- :fields          — partial response field mask string. Omitting returns
                     the entire presentation which can be megabytes for
                     large decks — pass a narrow mask if possible.
- :read-timeout-ms — int, override the HTTP client's default read timeout
raw docstring

group-objects-requestclj

(group-objects-request group-object-id children-object-ids)

Group multiple page elements together.

group-object-id — object ID for the new group children-object-ids — vector of object IDs to group

Group multiple page elements together.

group-object-id  — object ID for the new group
children-object-ids — vector of object IDs to group
raw docstring

insert-table-columns-requestclj

(insert-table-columns-request table-object-id
                              cell-location
                              number
                              insert-right?)

Insert columns into a table.

insert-right? — boolean; true to insert to the right, false for left.

Insert columns into a table.

insert-right? — boolean; true to insert to the right, false for left.
raw docstring

insert-table-rows-requestclj

(insert-table-rows-request table-object-id cell-location number insert-below?)

Insert rows into a table.

table-object-id — table object ID cell-location — {:row-index :column-index} of a reference cell number — int number of rows to insert insert-below? — boolean; true to insert below, false for above

Insert rows into a table.

table-object-id — table object ID
cell-location   — {:row-index :column-index} of a reference cell
number          — int number of rows to insert
insert-below?   — boolean; true to insert below, false for above
raw docstring

insert-text-requestclj

(insert-text-request object-id text & [{:keys [insertion-index cell-location]}])

Insert text into a shape or table cell.

object-id — text-bearing element object ID text — string to insert

opts:

  • :insertion-index — int; position within text content (0-based)
  • :cell-location — {:row-index :column-index} for table cells
Insert text into a shape or table cell.

object-id  — text-bearing element object ID
text       — string to insert

opts:
- :insertion-index — int; position within text content (0-based)
- :cell-location   — {:row-index :column-index} for table cells
raw docstring

refresh-sheets-chart-requestclj

(refresh-sheets-chart-request object-id)

Refresh an embedded Sheets chart, pulling the latest data.

Refresh an embedded Sheets chart, pulling the latest data.
raw docstring

replace-all-shapes-with-image-requestclj

(replace-all-shapes-with-image-request
  contains-text-text
  image-url
  &
  [{:keys [match-case replace-method page-object-ids] :or {match-case true}}])

Replace shapes containing matching text with an image.

contains-text-text — match text image-url — replacement image URL

opts:

  • :match-case — boolean (default true)
  • :replace-method — "CENTER_INSIDE" | "CENTER_CROP"
  • :page-object-ids — restrict to specific pages
Replace shapes containing matching text with an image.

contains-text-text   — match text
image-url            — replacement image URL

opts:
- :match-case        — boolean (default true)
- :replace-method    — "CENTER_INSIDE" | "CENTER_CROP"
- :page-object-ids   — restrict to specific pages
raw docstring

replace-all-shapes-with-sheets-chart-requestclj

(replace-all-shapes-with-sheets-chart-request
  contains-text-text
  spreadsheet-id
  chart-id
  &
  [{:keys [match-case linking-mode page-object-ids] :or {match-case true}}])

Replace shapes containing matching text with a Sheets chart.

opts:

  • :linking-mode — "LINKED" | "NOT_LINKED_IMAGE"
  • :page-object-ids — restrict to specific pages
Replace shapes containing matching text with a Sheets chart.

opts:
- :linking-mode    — "LINKED" | "NOT_LINKED_IMAGE"
- :page-object-ids — restrict to specific pages
raw docstring

replace-all-text-requestclj

(replace-all-text-request old-text
                          new-text
                          &
                          [{:keys [match-case page-object-ids]
                            :or {match-case true}}])

Replace all occurrences of text across the presentation.

opts:

  • :match-case — boolean (default true)
  • :page-object-ids — vector restricting replacement to specific pages
Replace all occurrences of text across the presentation.

opts:
- :match-case        — boolean (default true)
- :page-object-ids   — vector restricting replacement to specific pages
raw docstring

replace-image-requestclj

(replace-image-request image-object-id url & [{:keys [method]}])

Replace an existing image's content with a new URL.

image-object-id — object ID of the image to replace url — new image URL

opts:

  • :method — "CENTER_INSIDE" | "CENTER_CROP" — fit method
Replace an existing image's content with a new URL.

image-object-id — object ID of the image to replace
url             — new image URL

opts:
- :method — "CENTER_INSIDE" | "CENTER_CROP" — fit method
raw docstring

slides-clientclj

(slides-client credentials)
(slides-client credentials opts)

Build an authenticated Slides v1 REST client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically from csl/scoped-delegated-credentials or csl/user-credentials.

opts (optional):

  • :read-timeout-ms per-client default read timeout (default 120000 / 120s)
  • :connect-timeout-ms per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.

Build an authenticated Slides v1 REST client.

credentials — a com.google.auth.oauth2.GoogleCredentials instance, typically
from csl/scoped-delegated-credentials or csl/user-credentials.

opts (optional):
- :read-timeout-ms     per-client default read timeout (default 120000 / 120s)
- :connect-timeout-ms  per-client default connect timeout (default 30000 / 30s)

Per-request opts on individual call sites override the client-level defaults.
raw docstring

update-image-properties-requestclj

(update-image-properties-request object-id image-properties fields)

update-line-properties-requestclj

(update-line-properties-request object-id line-properties fields)

update-page-element-alt-text-requestclj

(update-page-element-alt-text-request object-id & [{:keys [title description]}])

Update the alt-text (title / description) of a page element.

Update the alt-text (title / description) of a page element.
raw docstring

update-page-element-transform-requestclj

(update-page-element-transform-request object-id transform apply-mode)

Update the transform (position/scale/rotation) of a page element.

transform — {:scale-x :scale-y :translate-x :translate-y :shear-x :shear-y :unit} apply-mode — "ABSOLUTE" | "RELATIVE"

Update the transform (position/scale/rotation) of a page element.

transform — {:scale-x :scale-y :translate-x :translate-y :shear-x :shear-y :unit}
apply-mode — "ABSOLUTE" | "RELATIVE"
raw docstring

update-page-properties-requestclj

(update-page-properties-request object-id page-properties fields)

Update properties of a page (slide / layout / master).

page-properties — e.g. {:page-background-fill {:solid-fill {:color {...}}}} fields — field mask string

Update properties of a page (slide / layout / master).

page-properties — e.g. {:page-background-fill {:solid-fill {:color {...}}}}
fields          — field mask string
raw docstring

update-paragraph-style-requestclj

(update-paragraph-style-request object-id
                                style
                                text-range
                                fields
                                &
                                [{:keys [cell-location]}])

Update paragraph style over a range.

object-id — text-bearing element object ID style — paragraph style properties (e.g. {:alignment "CENTER"}) text-range — range descriptor fields — field mask string

opts:

  • :cell-location — {:row-index :column-index} for table cells
Update paragraph style over a range.

object-id  — text-bearing element object ID
style      — paragraph style properties (e.g. {:alignment "CENTER"})
text-range — range descriptor
fields     — field mask string

opts:
- :cell-location — {:row-index :column-index} for table cells
raw docstring

update-shape-properties-requestclj

(update-shape-properties-request object-id shape-properties fields)

Update properties of a shape (fill, outline, shadow, etc.).

shape-properties — e.g. {:shape-background-fill {:solid-fill {:color {...}}}} fields — field mask string

Update properties of a shape (fill, outline, shadow, etc.).

shape-properties — e.g. {:shape-background-fill {:solid-fill {:color {...}}}}
fields           — field mask string
raw docstring

update-slide-properties-requestclj

(update-slide-properties-request object-id slide-properties fields)

Update properties of a slide.

slide-properties — e.g. {:slide-background-fill {:solid-fill {:color {...}}}} fields — field mask string, e.g. "slideBackgroundFill"

Update properties of a slide.

slide-properties — e.g. {:slide-background-fill {:solid-fill {:color {...}}}}
fields           — field mask string, e.g. "slideBackgroundFill"
raw docstring

update-slides-position-requestclj

(update-slides-position-request slide-object-ids insertion-index)

Move slides to a new position.

slide-object-ids — vector of slide object IDs to move (in order). insertion-index — int; destination index.

Move slides to a new position.

slide-object-ids — vector of slide object IDs to move (in order).
insertion-index  — int; destination index.
raw docstring

update-text-style-requestclj

(update-text-style-request object-id
                           style
                           text-range
                           fields
                           &
                           [{:keys [cell-location]}])

Update text style over a range.

object-id — text-bearing element object ID style — map of style properties (e.g. {:bold true :font-size {:magnitude 14 :unit "PT"}}) text-range — {:type "ALL"} or {:type "FIXED_RANGE" :start-index N :end-index N} fields — field mask string (e.g. "bold,fontSize")

opts:

  • :cell-location — {:row-index :column-index} for table cells
Update text style over a range.

object-id  — text-bearing element object ID
style      — map of style properties (e.g. {:bold true :font-size {:magnitude 14 :unit "PT"}})
text-range — {:type "ALL"} or {:type "FIXED_RANGE" :start-index N :end-index N}
fields     — field mask string (e.g. "bold,fontSize")

opts:
- :cell-location — {:row-index :column-index} for table cells
raw docstring

update-video-properties-requestclj

(update-video-properties-request object-id video-properties fields)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close