【发布时间】:2020-04-23 23:47:08
【问题描述】:
我正在尝试使用 G-Drive 中的 URL 将文件上传到 Google 协作平台。我正在使用此代码,它正在运行,但是当我刷新站点时,文件不会上传。
function uploadFiles(url, h) {
try {
var url = "myFileUrl";
var site = SitesApp.getSite("mySite", "myPage");
var page = site.getAllDescendants()[0];
var id = getIdFrom(url); // function that I have that gives you the id of an url
var blob = DriveApp.getFileById(id).getBlob();
var attachment = page.addHostedAttachment(blob);
return attachment.getUrl();
}
catch(error)
{
return error.toString();
}
【问题讨论】:
-
见minimal reproducible example。是否有错误或网址
returned?
标签: google-apps-script google-sites