0

I'm appending dozens of slides to presentations with a simple app script :

  var presentation_to = SlidesApp.openById(presentation_to_id);
  var presentation_from = SlidesApp.openById(presentation_from_id);
  var slide = presentation_from.getSlideById(slide_id);      
  var newSlide = presentation_to.appendSlide(slide); 

I have an app script API endpoint for that.

I started with one app script that would loop through all the slides IDs, but this had terrible performance and would timeout after 5 minutes. I've split my calls to the API app script to ask for one slide at a time, with parallelization (so I run several request to add a slide to the same presentation at once).

When the slides have big pictures in them, I still end up getting this :

Google::Apis::TransmissionError: execution expired

Is appendSlide() performance so bad what I want to do is not possible, or is there a way for me to make it work without having to wait 1h to generate one 50 slides presentation ?

PS : You'll find attached the logs of the script. Each line is meant to append ONE slide to a presentation (always the same destination). The execution times and error rates are just through the roof. Is performance simply limited by Google or is there a way to bypass this issue ?

4
  • 1
    Please add a minimal reproducible example. Commented Jul 29, 2020 at 17:29
  • Although I thought that you might want to reduce the process cost of your script, in order to correctly understand about your question, can I ask you about the relationship between your current issue and your script in your question? From the error message, you might run the Google Apps Script with ruby. But, I cannot understand about your detail situation. This is due to my poor skill. I deeply apologize for this. Commented Jul 29, 2020 at 23:08
  • Take a look at using batchupdate method. Commented Jul 30, 2020 at 18:30
  • @Rubén the 4 lines of code are enough show the effect, but to see the logs you would need to create a script with those lines on script.google.com. Then the goal is to import a slide with a heavy picture, and launch the app script several times. Tanaike the issue is when I call this script as an API endpoint a lot of times in parallel, because I need to append a lot of slides to a specific presentation Cooper batchUpdate unfortunately does not handle appendSlide() :( It really looks like there's a performance threshold on that function :/ Commented Aug 1, 2020 at 12:31

1 Answer 1

0

Considerations

Using Apps Script SlideApp built-in Class you are basically creating an API call every time you run .appendSlide() method. This will cause big network overhead when your script inserts a lot of slides.

Generally this is solved by using batch requests via Advanced Google Services. Unfortunately, there is no method to create a Page copy request that you could insert in a batch operation. If this is really important for your workflow you should consider filing a Feature Request

Reference

Slides API

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.