community/google-slides

Commands to create, read and edit Google Slides presentations using the Slides API

This package provides aux4 command wrappers for the Google Slides API v1. It covers creating presentations, reading a presentation or a single page (slide), and applying batch updates that add slides, insert text, shapes, images, and more.

Authentication is handled by community/google-auth, which stores a single OAuth2 token shared by every aux4 Google package.

Installation

aux4 aux4 pkger install community/google-slides

System Dependencies

This package requires:

  • jq — for parsing the JSON request array passed to batch-update
  • brew: brew install jq
  • linux: apt install jq

Prerequisites

Authenticate once with community/google-auth. The scopes are resolved from the installed Google service packages, so no --scopes flag is needed:

aux4 google auth login

This package requests https://www.googleapis.com/auth/presentations, which grants full create, read and edit access. For read-only use, request the narrower scope:

aux4 google auth login --readonly true

The read-only scope (https://www.googleapis.com/auth/presentations.readonly) is enough for get and pages get, but create and batch-update need the full presentations scope.

Check the current state at any time:

aux4 google auth status

Quick Start

Create a presentation:

aux4 google slides create --title "Quarterly Review"

Read it back (use the presentationId from the create response):

aux4 google slides get 1a2b3c4d5e6f

Read a single page (slide):

aux4 google slides pages get 1a2b3c4d5e6f --pageObjectId p1

Creating presentations

Create a new, empty presentation with a title:

aux4 google slides create --title "Team Onboarding"

The response includes the generated presentationId, the default slide layout, and the master and layout definitions Google created for you. Store the presentationId — every other command needs it.

Reading presentations

Fetch the full presentation, including every page, page element, and its properties:

aux4 google slides get 1a2b3c4d5e6f

Fetch a single page by its object ID:

aux4 google slides pages get 1a2b3c4d5e6f --pageObjectId p1

The page object ID for the first slide is usually p or p1; you can find every page's objectId in the output of aux4 google slides get.

Batch updates

The batch-update command sends a batchUpdate request with a raw JSON array of update operations. This is the primary way to change a presentation — add slides, insert text, create shapes, replace images, and more. The array is wrapped in a {"requests": [...]} envelope automatically.

Add a blank slide:

aux4 google slides batch-update 1a2b3c4d5e6f --requests '[{"createSlide":{}}]'

Insert text into an existing shape:

aux4 google slides batch-update 1a2b3c4d5e6f --requests '[{"insertText":{"objectId":"textbox1","text":"Hello, Sally!","insertionIndex":0}}]'

Multiple operations run in order within a single request:

aux4 google slides batch-update 1a2b3c4d5e6f --requests '[{"createSlide":{"objectId":"slide2"}},{"createShape":{"objectId":"box1","shapeType":"TEXT_BOX","elementProperties":{"pageObjectId":"slide2"}}}]'

See the Slides API request reference for the full list of supported operations.

Finding your Presentation ID

The presentation ID is the long identifier in the presentation URL:

https://docs.google.com/presentation/d/1a2b3c4d5e6f/edit
                                        ^^^^^^^^^^^^

It is also returned as presentationId when you run aux4 google slides create.

Environment Variables

  • AUX4_GOOGLE_TOKEN_FILE — where the shared Google OAuth token lives. Defaults to ~/.aux4.config/.oauth/google.json, the same location aux4 google auth login writes to, so it normally needs no setting.

For the optional integration test group, set SLIDES_PRESENTATION_ID to a presentation the authenticated account can read.

License

MIT — See LICENSE for details.