Unexpected Error with App Script: SlidesApp.Slide remove()

Pio
New Member

I am having an issue that I can't seem to find any information or help on. I am curious if others have encountered this or can reproduce it. 

A Google slides presentation with more than 1 slide, with any slide having more than 1 animation on it causes the first use of the remove() or move(index) function to fail with an Unexpected error.

I have a Google App Script which takes a Sheets spreadsheet and uses it to create a Slides slideshow from a saved Slides template in Drive. This script has run on two to three Sheets per day flawlessly for probably a year or two with no recent change to the code or template Slides slideshow.

On Tues, Aug 20th 2024 it started failing on the remove() function with Unexpected error while getting the method or property remove on object SlidesApp.Slide.

Using app script I can change text, change image references and set slides to be skipped/hidden. remove() and move(index) so far are all I've come across which throw this error, and only if the slideshow has more than 1 slide AND 1 or more slides have more than 1 animation on it. If you have a Slides presentation with no animations (or just 1 per slide max) it works as expected.

Here is a repro video: https://drive.google.com/file/d/1Ehw3vp83Z_CBpPguRdZoyLMHVVTWVH9r/

function moveEveryOddSlideToBeginning() {
  //slideshow : https://docs.google.com/presentation/d/1nO5w6ZXRUlKMg8MY2A5gqO6Wewa4Kl-RWimDQ4nGRTU
  var presentationId = "1nO5w6ZXRUlKMg8MY2A5gqO6Wewa4Kl-RWimDQ4nGRTU";
  var presentation = SlidesApp.openById(presentationId);
  var slides = presentation.getSlides();
  var count = 0;

  slides.forEach(function(slide, index) {
    count++;
    console.log(count);
    if (count % 2 == 1)
    {
      console.log("moving");
      slide.move(0);
    }
  });
}

 

0 0 87
0 REPLIES 0
Top Labels in this Space