我是该脚本的新手,并添加了可正常工作的脚本:
function sendEmailAlert() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var cellValue = ss.getActiveSheet().getActiveRange().getA1Notation();
var getRow = ss.getActiveSheet().getActiveRange().getRow();
var sheetname = ss.getActiveSheet().getName();
var user = Session.getActiveUser().getEmail();
var Toemail = '....email address....';
var subject = 'New Entry -' + ss.getName();
var body = 'Your file has a new entry in - ' + sheetname + ' Updated by - ' + user + ' check file- ' + ss.getUrl();
if(Number(ss.getActiveCell().getValue()!=-1.23456789) && getRow ==3) {
MailApp.sendEmail(Toemail,subject, body);
}
};
但是,由于我想找出更改了哪个特定单元格和新值,因此更新后的脚本无法保存,因此无法运行。我想错误在于var body,有人可以帮忙吗?
function sendEmailAlert() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var cellValue = ss.getActiveSheet().getActiveRange().getA1Notation();
var getRow = ss.getActiveSheet().getActiveRange().getRow();
var sheetname = ss.getActiveSheet().getName();
var user = Session.getActiveUser().getEmail();
var Toemail = '...email address';
var subject = 'New Entry -' + ss.getName();
var body = 'Your file has a new entry in - ' + sheetname + ' Updated by - ' + user + ‘New Value in –‘ + cellValue + ‘= ‘ +ss.getActiveCell().getValue() +
' check file- ' + ss.getUrl();
if(Number(ss.getActiveCell().getValue()!=-1.23456789) && getRow ==3) {
MailApp.sendEmail(Toemail,subject, body);
}
};
答案 0 :(得分:0)
对于var body
代码行存在问题,您是正确的:是‘
(弯引号)而不是'
(直引号)。