WESLEY CHUN: Hey, developers. Welcome to the “G
Suite Dev Show.” I’m your host, Wesley Chun. Today I’m joined by G Suite
engineer Grant Timmerman, who’s going to help me show you how
to enhance the Google Slides experience for both
presenters and audiences. Grant, can we get a
quick intro to add-ons? GRANT TIMMERMAN: Sure. Add-ons let you take
popular GC apps, such as Gmail, Google Sheets,
Slides, Docs, or Forms, and extend their functionality. Add-ons give
developers the ability to integrate your
apps with ours. WESLEY CHUN: Add-ons are
powered by Google Apps Script, a customized server-side
flavor of JavaScript that gives your apps controlled
access to G Suite data and other Google and
external services. Check out the intro video if
you’re new to Apps Script. Or, if you already
know Apps Script, check out our first
video on Slides add-ons. GRANT TIMMERMAN: Whether
you’re attending a presentation or delivering one,
sometimes it’s good to know how
far along you are. The problem is that
Google Slides itself doesn’t have a progress bar. So let’s add one. Let’s get to the computer,
where Wes will walk you through the add-on. WESLEY CHUN: Thanks, Grant. By the way, the code is also
available at the progress bar source code link. So feel free to follow along. Let’s get started. At the top are the variables
for an arbitrary progress bar ID, as well as the desired pixel
height, and finally a handle to the current presentation. The first pair of
short functions form the boilerplate
necessary to designate this Apps Script as an
add-on and what shows up in the add-on menu,
toggling the creation or removal of the progress
bars on the slides. The Create Bars function adds
progress bars to each slide, and similarly Delete
Bars removes them. Both of these functions
loop through each slide, either creating the progress
bar rectangles or removing them. When adding them,
Create Bars calculates the correct percentage,
so the rectangle added to the bottom
of each slide accurately represents
how far along it is in the presentation. The Bar ID is used to flag
the progress bar rectangles so that Delete Bars
removes only those and not rectangles
that are actually part of the slide content. You put hours into
this presentation, so obviously you wouldn’t
want this feature to mess around with your
current masterpiece, right? And using the add-on
is just as simple. Add the code to
the script editor for any Google Slides
presentation for which you have edit access. You’ll see the show-and-hide
progress bar menu items and can use them as if
Google Slides already had this feature built in. Let’s scroll down so we
could see the progress bars as I add them then
move to another slide so you can see them
disappear when I remove them. To distribute your add-on to
others, you must publish it. Users can install
published add-ons directly to their presentations
without knowing or seeing any of your code. This demo shows how you
can add core functionality to your favorite G Suite apps. And best of all, it doesn’t have
to take too many lines of code. Thanks for making this
cool add-on, Grant. GRANT TIMMERMAN: Sure, Wes. To dig deeper into the code
and read more about the add-on, check out the Quickstart
pages in the docs. WESLEY CHUN: To learn
more about other add-ons, like for Docs, Sheets, or Forms,
check out the Add-ons Overview page. GRANT TIMMERMAN:
Outside of Apps Script, you can write regular web or
mobile apps using the REST API. Check out the other
developer videos which show you how to use
Apps Script or the API to integrate with Google Slides. WESLEY CHUN: This is just
one of the many ideas of how you can extend G Suite apps. We invite you to
enhance this example. For instance, I find the
progress bar’s default color a bit too light. Can we darken them? Well, the rectangle’s
color is called the fill. So your hint is look for
the getFill and setSolidFill methods. GRANT TIMMERMAN:
A progress bar is a great feature
for both presenters as well as the audience. And this short
example shows you, one, that you can add
missing features and two, you don’t need a full
blown app to implement one. The sky’s the limit to what
you can do with add-ons. WESLEY CHUN: Glad you
could join us today. And special thanks to
Grant for helping out. This is Wesley Chun. I’ll see you upstairs
in the G Suite. [MUSIC PLAYING]