【问题标题】:Google Sheets AppsScript - Send an email when 1 cell changes to FalseGoogle Sheets Apps 脚本 - 当 1 个单元格更改为 False 时发送电子邮件
【发布时间】:2023-01-20 01:28:16
【问题描述】:

我找到了一些 AppsScript 示例,但没有一个与我正在尝试做的相匹配。

我有一个 google 表格,如果 1 个特定的单元格值从 TRUE 变为 FALSE,我想收到一封电子邮件。此单元格具有 IF 功能,并且会根据其他事件发生变化。如果值更改为 false,我只想要一封电子邮件。

我知道我需要在 Apps 脚本中创建一个函数和一个触发事件,但我似乎无法使代码正确。

工作表中的选项卡是健康月我正在查看的 Cell 是F2.任何帮助,将不胜感激。

谢谢

【问题讨论】:

    标签: email google-apps-script google-sheets


    【解决方案1】:

    尝试以下脚本:

    function emailSender(e) {
      var ss = SpreadsheetApp.getActive().getSheetByName('HealthMon');
      var r = ss.getRange("F2");
      if(r.getValue()==true)
      {
        GmailApp.sendEmail("user@domain.com", "Test subject", "This is a test message");
    // Change the email address to the desired one
      }
    }
    

    确保add the following trigger

    参考:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-15
      • 2020-05-10
      • 1970-01-01
      • 1970-01-01
      • 2021-11-21
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      相关资源
      最近更新 更多