我想从 Google Slide deck 中提取笔记并将它们插入到 Google Sheet 中。
我在 here 找到了执行此操作的代码。稍作修改后,代码如下:
function speakerNotes() {
const slides = SlidesApp.openById('1VmtdJD3caUNADGF-eAYV09oPaem1s9WMy5Xut767wGs').getSlides();
const allNotes = [];
slides.map((slide, index) => {
const note = slide.getNotesPage().getSpeakerNotesShape().getText().asString();
allNotes.push([index + 1+') ' ,note.replace('\n','')]);
});
console.log(allNotes)
const ss = SpreadsheetApp.openById('1vmnpQ3rpUtWQobLTSG4MDCCHMhHoKoIygRWEYt-RYXU');
const sheet = ss.getSheetByName('Speaker Notes')
sheet.getRange(1,1,allNotes.length,allNotes[0].length).setValues(allNotes)
sheet.autoResizeColumns(1,2)
}
代码没有提取幻灯片中的注释。相反,我在我的谷歌表格中得到了这个:
任何帮助将不胜感激!
*********更新 我已经使用建议的编辑和我自己的编辑更正了我的代码。现在可以用了。
getText
是TextRange
的一种方法。您缺少括号()
替换
const note = slide.getNotesPage().getSpeakerNotesShape().getText.toString();
与
const note = slide.getNotesPage().getSpeakerNotesShape().getText().toString();