根据Google表格中的单元格值更改将电子邮件发送到特定地址 [英] Send email to specific addresses based on cell value change in google sheets
本文介绍了根据Google表格中的单元格值更改将电子邮件发送到特定地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当电子表格的G列中的单元格更改为已付费"时,我都希望将电子邮件发送到同一行的J和K列中包含的地址,并且电子邮件主题为该行的A列,以及电子邮件已付费"
Whenever a cell in column G of my spreadsheet is changed to "paid", I would like emails to be sent to the addresses contained in columns J and K on the same row, with the email subject being column A of that row, and the email message "paid"
我已经看到了几个类似的问题,但是是新手,并且很难修改它们以满足我的项目需求.任何帮助表示赞赏!
I have seen several similar questions, but am a novice user and have trouble modifying them to suit my project needs. Any help appreciated!
推荐答案
function onEdit(e) {
var sh=e.range.getSheet();
if(e.range.columnStart==7 && e.value.toLowerCase()=='paid' && sh.getName()=='Sheet Name') {
var vA=sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()).getValues()[0];
var recipient=Utilities.formatString('%s,%s', vA[9],vA[10]);
var subject=vA[0];
GmailApp.sendEmail(recipient, subject, 'Paid');
}
}
注意:您不能从脚本编辑器运行此功能.您还必须在第3行中更新SheetName
Note: You cannot run this function from the script editor. You will also have to update the SheetName in line 3
这篇关于根据Google表格中的单元格值更改将电子邮件发送到特定地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文