在编写脚本方面我有点无能为力,当单个列(比如 a 列)中的日期是明天时,是否可以将代码块添加到脚本编辑器中?
每天早上发一封电子邮件就太棒了。
我目前设置了条件格式以在日期为明天时更改单元格的颜色,但电子邮件通知会更有用
谢谢!
最佳答案
您要找的是GmailApp.sendEmail()
.
但是,这不能在脚本编辑器中运行。它只能在工作表单元格值通过用户输入修改时触发。这个特别Google Docs Help Forum post讨论它。
从上面的链接接受的答案:
Replace existing code with:
Note: This script cannot be run from the script editor. It can only be run by entering a number less than 3 in col M after the trigger is set up.
function missingNotification(e) { //Add the trigger from the Resources menu in the Dev Editor //DevEditor>Resources>Current Project's Triggers>Add trigger // missingNotification -- From spreadsheet -- On edit var r = e.range; var s = r.getSheet(); var ss = e.source; var sName = s.getSheetName(); if(sName != "sheet" || r.getColumn() != 13) return; var value = e.value; if(value >= 3) return; var value2 = s.getRange(r.getRow(), 10).getValue(); value = value.toString(); var email = Session.getActiveUser().getEmail(); GmailApp.sendEmail(email, 'My Notification', 'Missing ' + value2 + ', there is ' + value + '\n\n'+ss.getUrl()); }
Save the code and set up the On edit trigger from the Resources menu per comments in code
Once this is done if it still doesn't email then Close the Spreadsheet and reopen and retry entering number in M
关于css - 当列中的日期是明天时,Google 表格电子邮件通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42134641/