This page describes how to add slides to an existing Google Slides presentation.
Slides
Each individual page of a Slides presentation is a slide.
To add a slide to the presentation, you need the presentation ID. You can find the presentation's ID by opening the presentation in 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 slide to a presentation. All the fields
for
CreateSlideRequest
are optional. This example creates the 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 create the slide, you can add text and shapes to it.
Fill in placeholders
Layouts normally have placeholder shapes that are copied to the slide when it's
created. CreateSlideRequest
lets you specify the object IDs used for these
copied placeholders through the placeholderIdMappings
field. This lets you
modify the copied placeholders in the same batchUpdate
request, which improves
performance and saves quota. For more information, see the
CreateSlideRequest
sample.