【发布时间】:2015-03-30 13:32:24
【问题描述】:
我每周都会收到一个通过电子邮件发送的压缩 csv 文件,并编写了一个谷歌应用脚本来从电子邮件中获取文件并保存到驱动器:
// unzip it
var unzipblob = Utilities.unzip(att[z]);
// Create with a unique filename using date of email
var newName = 'provider_stats-' + Utilities.formatDate(date, 'GMT', 'yyyy-MM-dd') + '.csv';
// Save the first file (there's only one) in the zip
file = folder.createFile(newName, unzipblob[0].getDataAsString());
file.setDescription(newName);
这工作正常,但我注意到在我保存它的驱动器文件夹中,它似乎与我手动执行的文档类型不同。当我右键单击时,其他选项提供“在 Google 表格中打开”作为选项,但不是从脚本中保存的选项。
知道如何设置文档类型或格式,以便可以直接在 Google 表格中打开吗?
我的下一步是直接保存为 Google 表格,因此提前提供的任何帮助也将被视为答案!
【问题讨论】:
标签: csv google-apps-script google-drive-api google-sheets