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:
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.(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:
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(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:
Insert an image into a slide. url — public image URL accessible by Slides element-properties — placement opts: - :object-id — caller-supplied object ID
(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:
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
(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:
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(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:
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-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:
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(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:
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
(create-slide-request &
[{:keys [object-id insertion-index predefined-layout
placeholder-id-mappings]}])Insert a new slide at the given position.
opts:
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 "..."}(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:
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
(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:
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
(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.
(delete-paragraph-bullets-request object-id
text-range
&
[{:keys [cell-location]}])Remove bullets from paragraphs in a range.
opts:
Remove bullets from paragraphs in a range.
opts:
- :cell-location — {:row-index :column-index} for table cells(delete-table-column-request table-object-id cell-location)Delete the column containing the specified cell.
Delete the column containing the specified cell.
(delete-table-row-request table-object-id cell-location)Delete the row containing the specified cell.
Delete the row containing the specified cell.
(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:
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(duplicate-object-request object-id & [{:keys [object-ids]}])Duplicate an object (slide or page element) by object ID.
opts:
Duplicate an object (slide or page element) by object ID. opts: - :object-ids — map of original ID → new ID for chained duplication
(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.
(get-page client presentation-id page-object-id & [opts])Get a single page (slide / layout / master / notes) by 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-page-thumbnail client presentation-id page-object-id & [opts])Get a thumbnail image URL for a page.
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-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:
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(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
(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.
(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(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:
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(refresh-sheets-chart-request object-id)Refresh an embedded Sheets chart, pulling the latest data.
Refresh an embedded Sheets chart, pulling the latest data.
(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:
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-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:
Replace shapes containing matching text with a Sheets chart. opts: - :linking-mode — "LINKED" | "NOT_LINKED_IMAGE" - :page-object-ids — restrict to specific pages
(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:
Replace all occurrences of text across the presentation. opts: - :match-case — boolean (default true) - :page-object-ids — vector restricting replacement to specific pages
(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:
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
(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):
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.
(update-image-properties-request object-id image-properties fields)(update-line-properties-request object-id line-properties fields)(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.
(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"(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(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:
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-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(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"(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.
(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:
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-video-properties-request object-id video-properties fields)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |