css - 当列中的日期是明天时,Google 表格电子邮件通知

标签 css excel google-sheets google-sheets-api

在编写脚本方面我有点无能为力,当单个列(比如 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/

相关文章:

html - 具有多列布局和移动 div 框排序的 flexbox

vba - 通过电子邮件 ID 从 Excel 中的联系人列表中获取姓名

javascript - 语法错误: Unexpected identifier while Parsin XML Data Using Google App Script

css - Bootstrap Scrollspy 不适用于 float 内容 (spanX)

html - 如何在 css3 选择器中交替显示两列的颜色?

css - 具有重复不规则图案的纯 flexbox 网格

vba - VBA 是否可以检测该列是否没有值并停止将其百分比制表?

excel - 在 VBA 中使用 Range.Find 仅查找前一个值 x?

python - 如何下载带有 Gspread 的 Google Docs excel 表并在本地访问数据(A1 表示法)?

function - 我可以将 onEdit 函数限制为 Google 表格中的复选框单元格吗?