我对此代码有困难。我制作副本,发送电子邮件,但电子邮件不包含附件。我很感激任何想法。
var ss = SpreadsheetApp.getActiveSpreadsheet();
var MyNewBook = ss.copy("A Copy of " + ss.getName());
var MyUser = Session.getActiveUser().getEmail()
MailApp.sendEmail(MyUser, 'TEST', MyNewBook);
答案 0 :(得分:1)
以下示例脚本怎么样? MailApp.sendEmail()
的详细信息为https://developers.google.com/apps-script/reference/mail/mail-app#sendEmail(Object)
var ss = SpreadsheetApp.getActiveSpreadsheet();
var filename = "A Copy of " + ss.getName();
var MyNewBook = ss.copy(filename);
var MyUser = Session.getActiveUser().getEmail();
MailApp.sendEmail({
to: MyUser,
subject: 'TEST title',
body: 'TEST body',
attachments: [MyNewBook.getBlob().setName(filename)]
});