I have a google slide desk with three slides & i want to add a comment to each slide. I am able to reach to the slide using for loop (total rows in sheet is same as total number of slides, and slide i am using is the second slide onwards. so there is no problem with my loop)
// open the slide using slide id
var s=SlidesApp.openById(a.getId())
for(let r=2; r<=4; r++){
// get the current slide
var currentSlide=s.getSlides()[r-1];
var fileId = currentSlide.getObjectId();
var slideUrl = a.getUrl()+"#slide=id."+fileId;
var slideId = getIdFromUrl(slideUrl);
var comment = {'content':'hi'};
Drive.Comments.insert(comment, slideId);
}
function getIdFromUrl(url) { return url.match(/[-\w]{25,}/); }
This code works but its adding the comment to the file and not to the individual slide. (*Note - For this code to work, we have to enable Drive in services in app script.) How can i add the comment to the individual slides.