googleslides的GUI提供下载GSlides演示文稿作为Powerpoint(myFile.pptx)。我在googleapps脚本文档中找不到等价的东西-任何指针?
感谢评论和回答,我尝试了以下片段:
function testFileOps() {
// Converts the file named 'Synthese' (which happens to be a Google Slide doc) into a pptx
var files = DriveApp.getFilesByName('Synthese');
var rootFolder = DriveApp.getRootFolder();
while (files.hasNext()) {
var file = files.next();
var blobPptx = file.getBlob().getAs('application/vnd.openxmlformats-officedocument.presentationml.presentation');
var result = rootFolder.createFile(blobPptx);
}
}
从application/vnd.google-apps.presentation转换为
应用程序/vnd.openxmlformats-officedocument.presentationml.presentation
第二次编辑
根据评论中的另一个建议,我尝试从googleappscript发出一个http调用,直接将gslides转换为pptx,而不受大小限制。它在G驱动器上生成一个文件,但该文件已损坏/无法读取。气体脚本:
function convertFileToPptx() {
// Converts a public Google Slide file into a pptx
var rootFolder = DriveApp.getRootFolder();
var response = UrlFetchApp.fetch('https://docs.google.com/presentation/d/1Zc4-yFoUYONXSLleV_IaFRlNk6flRKUuAw8M36VZe-4/export/pptx');
var blobPptx = response.getContent();
var result = rootFolder.createFile('test2.pptx',blobPptx,MimeType.MICROSOFT_POWERPOINT);
}
笔记:
-
here
-
使用mime类型
'pptx'
返回相同的错误消息