Posted by Wesley Chun (@wescpy), Developer Advocate, G Suite
The G Suite team recently launched the very
first Google Slides API,
opening up a whole new set of possibilities, including leveraging data
already sitting in a spreadsheet or database, and programmatically
generating slide decks or slide content based on that data. Why is this
a big deal? One of the key advantages of slide decks is that they can take
database or spreadsheet data and make it more presentable for human consumption.
This is useful when the need arises to communicate the information reflected by
that data to management or potential customers.
Walking developers through a short application demonstrating both the Sheets and
Slides APIs to make this happen is the topic of today's DevByte video. The
sample app starts by reading all the necessary data from the spreadsheet using
the Sheets API. The Slides API takes over from there, creating new slides for
the data, then populating those slides with the Sheets data.
Developers interact with Slides by sending API requests. Similar to the Google Sheets API, these requests
pseudocode below featuring requests to create a cell table on a slide and import
a chart from a Sheet:
Creating tables is fairly straightforward. Creating charts has some magical
features, one of those being the linkingMode. A value of "LINKED"
means that if the Sheet data changes (altering the chart in the Sheet), the same
chart in a slide presentation can be refreshed to match the latest image, either
by the API or in the Slides user interface! You can also request a plain old
static image that doesn't change with the data by selecting a value of
"NOT_LINKED_IMAGE" for linkingMode. More on this can be found in
on creating charts, and check out the video where you'll see both those API
requests in action.
For a detailed look at the complete code sample featured in the video,
check out the deep dive post. We look forward
to seeing the interesting integrations you build with the power of both APIs!
Formatting spreadsheets is accomplished by creating a set of request commands in
the form of JSON payloads, and sending them to the API. Here is a sample
the first row of the default Sheet automatically created for you (whose ID is
For more details on the code in the video, check out the deepdive blog post. As you can probably
guess, the key challenge is in constructing the JSON payload to send to API
operations samples can really help you with this. You can also check out our
through writing a Node.js app that manages customer orders for a toy company,
featuring the toy orders data we looked at today but in a relational database. While
the resulting equivalent Sheet is featured prominently in today's video, we will
revisit it again in an upcoming episode showing you how to generate slides with
spreadsheet data using the new Google Slides
API, so stay tuned for that!
We hope all these resources help developers enhance their next app using G Suite
APIs! Please subscribe to our channel and tell us what topics you would like to
see in other episodes of the G Suite Dev
Posted by Wesley Chun, Developer
Advocate, G Suite
At Google I/O 2016, we gave developers a preview of the Google Slides API. Since then,
the gears have been cranking at full speed, and we've been working with various
early-access partners and developers to showcase what you can do with it. Today,
we're happy to announce that the
Slides API v1 is now generally available and represents the first time that
developers have ever been able to programmatically access Slides!
The Slides API breaks new ground, changing the way that presentations are
created. No longer do they require manual creation by users on their desktops or
mobile devices. Business data on inventory items like retail merchandise,
homes/property, hotels/lodging, restaurants/menus, venues/events, and other
"cataloged" assets can be instantly turned into presentations based on
pre-existing slide templates. Traditionally, the sheer amount of data (and of
course time[!]) that went into creating these slide decks made it unwieldy if
done by hand. Applications leveraging the API can easily generate presentations
like these, customized as desired, and in short order.
Developers use the API by crafting a JSON payload for each request. (We
recommend you batch multiple commands together to send to the API.) You can
think of these as actions one can perform from the Slides user interface but
available programmatically. To give you an idea of how the new API works, here
are what some requests look like for several common operations:
// create new slide (title & body layout)
// insert text into textbox
"text": "Hello World!"
// add bullets to text paragraphs
// replace text "variables" with image
If you're interested in seeing what developers have already built using the API,
take a look at our initial set of partner integrations by Conga, Trello,
Lucidchart, Zapier and more, as described in detail in our G Suite blog post.
To help you get started, check out the DevByte above from our new series dedicated to G Suite developers.
In the video, we demonstrate how to take "variables" or placeholders in a
template deck and use the API to generate new decks replacing those proxies with
the desired text or image. Want to dive deeper into its code sample? Check out
this blogpost. If you're not a Python
developer, it'll be your pseudocode as you can use any language
supported by the Google APIs Client
Libraries. Regardless of your development environment, you can use similar
"scaffolding" to generate many presentations with varying content for your
users. Stay tuned for more videos that highlight other Slides API features.
The Slides API is available to projects in your Google Developers console today.
Developers can find out more in the official documentation which
features an API
overview plus Quickstarts, sample code in multiple languages and
environments, to bootstrap your next project. We look forward to seeing all the
amazing slide deck generating applications you build with our first ever API!