我正在尝试防止在发送值时发送电子邮件

我为工作中的引擎构建了一个结帐系统。该计划的一部分是必须每天进行结帐。我创建了一个脚本,该脚本在当天未填写电子邮件时发送电子邮件。它运行良好,我每天晚上9点和10点触发它。现在,这些钻机有时会停运,并且在停工时不需要进行检查。我做到了,所以当他们停止使用钻机时,它就会反映在他们的每日记录中。

我以为我可以正常工作,但是我的第一个钻机停产了,但仍然发送了电子邮件。我认为具有条件条件IF的第三列中的值不是“服务中断”,它将继续,并且如果确实说“服务中断”,则会停止脚本。我的代码有什么错?

https://docs.google.com/spreadsheets/d/134DFqUNgUihWacm3hNd4B9Zqe-BYubYRXd-hh15fgK8/edit?usp=sharing

#...

with open('encrypted_data.bin','wb') as out_file:
    recipient_key = RSA.import_key(
    open('my_rsa_public.pem').read())
    session_key = get_random_bytes(16)
    cipher_rsa = pkcs1_OAEP.new(recipient_key)
    out_file.write(cipher_rsa.encrypt(session_key))

    cipher_aes = AES.new(session_key,AES.MODE_EAX)
    data = b'blah blah bl'
    ciphertext,tag = cipher_aes.encrypt_and_digest(data)

    out_file.write(cipher_aes.nonce)
    out_file.write(tag)
    out_file.write(ciphertext)

#...
fleia 回答:我正在尝试防止在发送值时发送电子邮件

CountCola()返回整数或什么都不返回;

var lastRow = CountColA();

var emailSent=lastrow[3];,但lastRow不是数组。

因此很难说出此行中的电子邮件已发送:if (emailSent != "Out of service")

,

您不需要CountColA函数来获取最后一行。您可以简单地使用getLastRow函数[1]:

sheet.getLastRow();

并获得像这样的列C值:

sheet.getRange(lastRow,3).getValue();

此外,我测试了您的代码,并且lastDate变量不正确,因此您应该查看如何从字符串[2]创建日期或将日期的数据验证放入时间戳列中,以便直接检索日期值。

[1] https://developers.google.com/apps-script/reference/spreadsheet/sheet#getlastrow

[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

本文链接:https://www.f2er.com/3140934.html

大家都在问