how to publish to the web a spreadsheet using drive API and GAS

大城市里の小女人 提交于 2019-12-06 15:36:58

several months later, we got the solution !!

//this function publish to the web the document given by ID (google sheets or docs)
function publishToWeb(){ 
var fileId = 'WqcTq4c3iumeEUSgPMCcM8yKUqycQsrn_w3XeE'; 
var revisions = Drive.Revisions.list(fileId); 
var items = revisions.items; 
var revisionId =items[items.length-1].id; 
var resource = Drive.Revisions.get(fileId, revisionId); 
resource.published = true;
resource.publishAuto = true;
resource.publishedOutsideDomain = true;
Drive.Revisions.update(resource, fileId, revisionId); 
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!