google-apps-script - 将电子表格本地下载到我的电脑的脚本

标签 google-apps-script google-sheets

我有 script下载我的电子表格,但它只是将它保存到谷歌驱动器。 任何人都可以帮助我知道如何将它下载到我电脑上的本地文件夹吗? 谢谢

最佳答案

您可能想尝试使用 Content Service :

When a script is published as a web app, the special callback functions doGet() and doPost() are invoked whenever a request is made to the script's URL. Instead of returning a user interface object created with the HTML service, the Content service can be used to return raw textual content. This allows you to write scripts that act as "services", responding to GET and POST requests and serving data of various MIME types.

您可以在那里触发下载,甚至可以通过 TextOutput.downloadAsFile 设置文件名方法。

尝试查看相关的 SO 帖子:Download file from Google Drive to local folder from Google Apps ScriptGoogle App Script ContentService downloadAsFile not working .

希望这些信息对您有所帮助。

关于google-apps-script - 将电子表格本地下载到我的电脑的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41701751/

相关文章:

email - Google脚本:MailApp.sendEmail到多个地址?

javascript - 如何将每张纸的列设置为纯文本格式?

asynchronous - 使用 promise 对 Google 表格进行多次查询

google-apps-script - 在 Google 表格模板的容器绑定(bind)脚本中维护启用的 API

google-apps-script - 如何将链接转换为文件名?

google-apps-script - 工作时间只触发

javascript - 有什么方法可以在 Google 表单上设置默认选择吗?

JavaScript 谷歌电子表格 : set the value of cell based on a match

google-apps-script - 如何计算Google表格文档中的公式数量?

javascript - 正则表达式匹配美元,前面没有反斜杠