Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从绑定到Google工作表的JavaScript向Google云存储写入文本文件?_Javascript_Google Apps Script_Google Cloud Storage - Fatal编程技术网

如何从绑定到Google工作表的JavaScript向Google云存储写入文本文件?

如何从绑定到Google工作表的JavaScript向Google云存储写入文本文件?,javascript,google-apps-script,google-cloud-storage,Javascript,Google Apps Script,Google Cloud Storage,不久前,我创建了一个带有绑定JavaScript的Google工作表,它从Google工作表内容中汇编电子邮件文本,将文本作为html文件保存到Google驱动器,然后将html作为电子邮件正文发送,并链接到标记为“查看为html”的html页面 当Google停止允许GoogleDrive托管html页面时,我创建了一个Zapier触发器将页面复制到DropBox。现在DropBox也不再支持托管html页面 我从文档中了解到,谷歌云存储将承载html页面。我还没有找到一种方法将绑定到谷歌工作

不久前,我创建了一个带有绑定JavaScript的Google工作表,它从Google工作表内容中汇编电子邮件文本,将文本作为html文件保存到Google驱动器,然后将html作为电子邮件正文发送,并链接到标记为“查看为html”的html页面

当Google停止允许GoogleDrive托管html页面时,我创建了一个Zapier触发器将页面复制到DropBox。现在DropBox也不再支持托管html页面

我从文档中了解到,谷歌云存储将承载html页面。我还没有找到一种方法将绑定到谷歌工作表的JavaScript文本文件写入谷歌云存储

  var outFile = DriveApp.getFolderById('0B4Oo7-sRYcsLRlp1V056a21CNEk').createFile(String(String(Number(dtNow))) + ".html", stBdy)  

  stBdy = stBdy.replace('<p align="right">webpage view</p>','<p align="right"><a href="https://dl.dropboxusercontent.com/u/18189100/' + String(Number(dtNow)) +'.html" target="_blank">View As Webpage</a></p>');

  GmailApp.sendEmail(stTo, stSbj, stBdy, {replyTo: stReply, htmlBody: stBdy});
下面是我现在使用的代码片段。我想用将文件写入谷歌云存储的代码替换第一条语句,即将文本文件写入谷歌硬盘

  var outFile = DriveApp.getFolderById('0B4Oo7-sRYcsLRlp1V056a21CNEk').createFile(String(String(Number(dtNow))) + ".html", stBdy)  

  stBdy = stBdy.replace('<p align="right">webpage view</p>','<p align="right"><a href="https://dl.dropboxusercontent.com/u/18189100/' + String(Number(dtNow)) +'.html" target="_blank">View As Webpage</a></p>');

  GmailApp.sendEmail(stTo, stSbj, stBdy, {replyTo: stReply, htmlBody: stBdy});
var outFile=DriveApp.getFolderById('0B4Oo7-sRYcsLRlp1V056a21CNEk').createFile(String(String(Number(dtNow)))+“.html”,stBdy)
stBdy=stBdy.replace(“

webpage view

”,“

”); sendmail(stTo,stSbj,stBdy,{replyTo:stReply,htmlBody:stBdy});
布鲁斯·麦克弗森(Bruce Mcpherson)编写了一个可靠的地面军事系统库,并进行了深入的总结。您可以在以下网址找到:

最新消息:布鲁斯·麦克弗森的图书馆工作起来很有魅力。感谢Bruce fire写这篇文章,感谢Spencer推荐。由于Bruce的例子中没有使用我的“text/html”类型来保存文件,因此我将在Google搜索中添加这些文章。。。要让JavaScript将文件以“text/html”的形式保存到google云存储中,请先将文本转换为“text/html”类型的Blob对象,然后再将其传递给gsc库例程。