本文介绍了在Google电子表格中更新单元格时通过电子邮件通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是脚本新手,并添加了该脚本,该脚本有效:
I am new to script and added this script which worked:
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正文中,有人可以帮忙吗?
However, as I would like to find out which specific cell was changed and the new value, the updated script fails to save so I cannot run it. I guess the mistake is in var body, can anyone help?
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); } };
推荐答案
您认为正确的是 var body 代码行:用'(弯引号)代替'(直引号)。
You are right regarding that there is a problem on the var body code line: There are ‘ (curly quotes) instead of ' (straight quotes).
这篇关于在Google电子表格中更新单元格时通过电子邮件通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!