【发布时间】:2016-07-11 14:58:12
【问题描述】:
以下代码不起作用,并出现以下错误:
TypeError: 在对象 Drive 中找不到函数 getFileByID。
我正在尝试通过直接在脚本中提供 ID 进行测试:
var atta = DriveApp.getFileByID('1XD...c'); //ID is Folder and Google Doc ID I want to attach
MailApp.sendEmail(emailto, subject, message, {
cc: emailcc,
attachments:[atta]
});
最后,我想从 Google 电子表格中读取链接:
var range = active_actions.getRange(i+1,16) //active_actions is the spreadsheet and i+1,16 is the cell with the link
var link = range.getFormula();
var atta = DriveApp.getFileByID(link);
MailApp.sendEmail(emailto, subject, message, {
cc: emailcc,
attachments:[atta]
});
【问题讨论】: