非常感谢您提供有关如何修复此错误的指导。请参见以下给出错误的代码,
// Copy a slide from another presentation and inserts it.
var otherPresentation = SlidesApp.openById('1Fz6YWCyLIdHfDoonz-40qRlmnNCWwROIQjXqYwmRxS8');
var currentPresentation = SlidesApp.getActivePresentation();
var slide_v1 = otherPresentation.getSlides[0];
var insertionIndex = 1;
currentPresentation.insertSlide(insertionIndex, slide_v1);
答案 0 :(得分:1)
感谢Tanaike和代码的一些更改-这已经解决。请在下面查看更新的代码。
// Copy a slide from another presentation and inserts it.
var otherPresentation = SlidesApp.openById('1Fz6YWCyLIdHfDoonz-40qRlmnNCWwROIQjXqYwmRxS8');
var currentPresentation = SlidesApp.openById(documentId);
var slide_v1 = otherPresentation.getSlides()[0];
var insertionIndex = 1;
currentPresentation.insertSlide(insertionIndex, slide_v1);
在[0]
之后使用getSlides()
肯定有帮助
我删除了.duplicate()
,因为它在模板上创建了重复项。