How to Get Slide Count in Google Slides

How to Get Slide Count in Google Slides

Sometimes we're using Google slides and we want to get a slide count. We don't want to have to scroll down, see the slide or see total number of slides. We want to just see that in an easy automation. Let's go build that. We're going to go to extensions app script here. We're going to do two things. We're going to have an on open function , which is going to create a menu for us, but we're also going to create the function , get slide count. And here we'll start this as slides app dot get active presentation. We'll get slides, get, dot get length. We don't need parentheses at the end. And let's log this and see what it does. Logger dot log. Put that all inside of our log. Select it from here, get slide count run. And there we get 18. So that is the number of slides in the presentation.

But just seeing that here in Apps Script is not enough. We want to create a UI, and this UI is going to show a menu called Automations. We're going to add an item. The item is going to be GetSlideCount, but we're going to call the function GetSlideCount, this exact spelling here. Going to add that to UI. If we hit command S and save, what it's going to do is it's just going to log it. So we actually want to do variable count equals, take off this parenthesis, and create an alert. Get UI, alert, and the alert is going to show the count. But not just the count, we'll say count is Say slide count is and then add plus count. Save this.

We're going to close it and now we have to refresh our sheet or reopen our sheet so that that on open triggers. We now have an automations menu up here on the top. Get slide count. Slide count is 18. Okay. There we go. If you're looking for more automations, go to better sheets. co slash slides for this automation and more. There are tons of really cool automations I've put into one slide deck. Every automation is there. Looks just like this. You can create a summary slide, create the automations menu, can Add watermarks, replace text, duplicate slides, all kinds of cool stuff there. Go get it now, for free, over at bettersheets. co slash slides.