2

I'm facing an error

TypeError: Cannot read property 'batchUpdate' of undefined"

when I use the following code in my GAS:

var batchUpdateResponse = Slides.Presentations.batchUpdate(
  {
    requests: requests
  },
  presentationId
);

Google Slides API are enabled on both Cloud Console and Advanced Service in Resource of GAS.

Looks like Slides is called properly, since I run console.info(Slides) then get [Function: Slides].

However, Slides.Presentations is not called properly since console.info(Slides.Presentations) shows undefined.

Appreciated if someone can help.

Kos
  • 4,890
  • 9
  • 38
  • 42
Emiko
  • 21
  • 1
  • looks like you have redefined `Slides` in your code somewhere – Kos Aug 30 '20 at 17:35
  • Can you provide your whole releveant code snippet including `requests`? – ziganotschka Aug 31 '20 at 12:03
  • Thanks Kos and ziganotschka! Even I have simple code like below, it got undefined error. function test () { console.info(Slides); console.info(Slides.Presentations); } First console.info shows "[Function: Slides]", however second console.info shows "undefined". – Emiko Sep 04 '20 at 11:50
  • Are you using Rhino or v8? Is your Apps Script project bound to a standard GCP project? Is it an alone-standing script or bound to a Slides document? Doy you have more than 1 script file in your Apps Script project? Create a brand new Apps Script file and run your simple code - it should not result in any error if Advanced Slides Service is enabled. – ziganotschka Sep 07 '20 at 08:25

0 Answers0