I have a Google Sheet in which I would like to get an email notification when any cell changes in a specific column.
I am new to scripting so it is mind blowing, I have no idea on how to do this and would appreciate any assistance on this.
Column U2:U
Updated script
This works when I manually edit any cell in column U. However I would like to have an formula/arrayformula in this column but when I do this I stop receiving email notifications.
function sendMailEdit(e){
if (e.range.columnStart != 21 ) return;
GmailApp.sendEmail("email.address@gmail.com","Subject", "New Name Added - See Cell U" + e.range.rowStart + " Sheet Name")
}
Best Answer
You want to send an email when a value chnages in Column U2:U. Your
onEdit
script works but... You have formula/arrayformula in Column U and the script is not being triggered by changes in those values.An
onEdit
script is on triggered when a user changes a value in a spreadsheet. Changes due to formula do not trigger the script.Workaround
An option is to use a time-driven trigger.
The challenge is to establish whether a value in Column U has changed since the last time the script was run. The solution is to make a copy of the values in Column U and to compare these against the actual values when the script is executed.
The solution consists of two scripts:
function duplicaterange()
:function sendemail()
time-driven trigger
; the frequency is at your option.