Consolidating Google Slides

Web Applications Asked by user251141 on January 5, 2022

I am constructing a small app to consolidate slide decks within Google Drive.

For the most part the app works great. However, when I append a slide deck it only adds the first slide.


Obviously it only returns the first slide because of [0]. I have tried removing the [0] and .getSlides() [0] portions altogether, which results in an error. I cannot find a way in the documentation to list more than one slide. I have also tried using a variation of for loops to pull each slide, but my current code just gets ignored.

for (var i = 0; i < org1Slides.length; i++) {


for (slide in org1Slides) {

I am sure I am missing something small, but can someone point me in the direction of appending each slide from a presentation.

The desired outcome is that the code appends the entire slide deck to the overall presentation. The number of slides in each presentation is variable, so I can’t simply list each slide to be appended separately.

Full Code:

function consolidateSlides() {
  // use the 'Org Base' slides as the baseline
  var presentationId = '{presentation id hidden}';
  // set current month, rename to current slide deck
  var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];;
  var date = new Date();
  var currentMonth = months[date.getMonth()] + ' ' + date.getFullYear();
  var copyTitle = 'Meeting ' + currentMonth;
  var copyFile = {
    title: copyTitle,
  copyFile = Drive.Files.copy(copyFile, presentationId);

  // prepare current slide deck for appending org slides
  var currentPresentation = SlidesApp.openById(;
  // append org1 slides
  var org1Slides = SlidesApp.openById('{presentation id hidden}');
  // append org2 slides
  var org2Slides = SlidesApp.openById('{presentation id hidden});
  // append org3 slides
  var org3Slides = SlidesApp.openById('{presentation id hidden}');
  // append org4 slides
  var org4Slides = SlidesApp.openById('{presentation id hidden}');

  // append org5 slides
  var org5Slides = SlidesApp.openById('1{presentation id hidden}');

  // append org6 slides
  var org6Slides = SlidesApp.openById('{presentation id hidden}');


One Answer

I solved it after a few more hours of digging through documentation.

The openById() function does not return a list of slides. Using getSlides() provides a list of slides through which the for loop can iterate.


  // append org1 slides
  var org1Slides = SlidesApp.openById('{presentation id hidden}');

Turned in to:

  // append org1 slides
  var org1Slides = SlidesApp.openById('{presentation id hidden}');
  var currentSlides = org1Slides.getSlides();
  for (slide in currentSlides) {

Answered by user251141 on January 5, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP