/** * Creates a Slides API service object and logs the number of slides and * elements in a sample presentation: * https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit */functionlogSlidesAndElements(){constpresentationId="1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc";try{// Gets the specified presentation using presentationIdconstpresentation=Slides.Presentations.get(presentationId);constslides=presentation.slides;// Print the number of slides and elements in presentationconsole.log("The presentation contains %s slides:",slides.length);for(leti=0;i < slides.length;i++){console.log("- Slide # %s contains %s elements.",i+1,slides[i].pageElements.length,);}}catch(err){// TODO (developer) - Handle Presentation.get() exception from Slides APIconsole.log("Failed to found Presentation with error %s",err.message);}}