如何使用驱动器API和GAS将电子表格发布到Web上 [英] how to publish to the web a spreadsheet using drive API and GAS
本文介绍了如何使用驱动器API和GAS将电子表格发布到Web上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我激活了驱动API(V2),并尝试将文件发布到网络上。
I activate the drive API, (V2), and I try to publish to the web a file
我尝试了以下操作,但很明显,资源)。有人能帮助我吗?
很多提前感谢
I try the following, but obviously, I miss something (the resource). Can somebody help me? many thanks in advance
function test(){
var fileId = '1c5fRpKAk2YdUVzCa1LOCqDgTLZmYjsfSvTzR9BSGPYo';
var revisions = Drive.Revisions.list(fileId);
var items = revisions.items;
var revisionId = items[items.length-1].id;
var resource;
Drive.Revisions.update( resource , fileId, revisionId).published = true;
}
推荐答案
几个月后,解决方案 !!
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);
}
这篇关于如何使用驱动器API和GAS将电子表格发布到Web上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文