This page describes how to add slides to an existing Google Slides presentation.
Slides
Each individual page of a Google Slides presentation is a slide.
To add a slide to the presentation, you need the presentation ID to start with. You can find the presentation's ID by opening the presentation in Google Slides and looking at its URL:
https://docs.google.com/presentation/d/presentationID/edit
To add a slide, use the batchUpdate() method with the presentation ID and include a CreateSlideRequest in the request body. The ID of the new slide is returned in the response body.
Example
The following example shows how to add a new slide to a presentation. All the
parameters for the
createSlide
request are optional; this example creates the new slide as the second slide,
with TITLE_AND_TWO_COLUMNS
layout, and an explicit object ID.
Apps Script
Go
Java
JavaScript
Node.js
PHP
Python
Ruby
After you have created a new slide, you can begin to add text and shapes to it.
Filling in placeholders
Layouts normally have placeholder shapes on them that are copied to the slide when
it's created. CreateSlideRequest
lets you specify the object IDs used for these copied placeholders using the
placeholderIdMappings
field. This lets you to modify the copied placeholders
in the same batchUpdate
request, which improves performance and saves quota. See
the CreateSlideRequest sample for an example.