我已经使用Google Apps脚本构建了Google幻灯片演示文稿。
var docId = DriveApp.getFileById(templateId).makeCopy().getId();
var newDoc = DriveApp.getFileById(docId).setName(newDocName);
var newDocUrl = newDoc.getUrl(); // This gets the URL of the editing view. I want the presentation view.
如何发布它,然后获取发布的演示文稿的URL?
这是文档。我正在寻找类似的东西:
var publishedNewDoc = newDoc.publish();
var newDocPublishedUrl = publishedNewDoc.getPublishedUrl();
如果我的理解是正确的,那么这个答案呢?
为了发布Google文档,您可以使用修订方法:在Drive API中更新。关于此,您可以将示例脚本视为几个答案之一。
使用此脚本之前,请在高级Google服务中启用Drive API。
var slidesId = "###"; // Please set this.
Drive.Revisions.update({published: true, publishedOutsideDomain: true, publishAuto: true}, slidesId, 1);
当您手动将Google幻灯片发布到网络上时,您会看到类似的URL https://docs.google.com/presentation/d/e/2PACX-###/pub
。不幸的是,在当前阶段,无法检索此URL。因此,一种解决方法是,可以使用文件ID检索已发布的URL。带有Google幻灯片文件ID的已发布URL如下。
https://docs.google.com/presentation/d/### file ID ###/pub
如果我误解了您的问题,而这不是您想要的结果,我深表歉意。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句