This sample script sends an e-mail, when spreadsheet was edited from outside by Sheet API v4. When you use this sample, please create a container bound script with spreadsheet which is edited by Sheet API. And please input your e-mail and run firstly a method of createTrigger()
. By this, a trigger is installed as onChange()
. After this, edit spreadsheet from outside by Sheet API v4.
When when spreadsheet was edited from outside by Sheet API v4, I used sendEmail()
as a sample, because script editor is closed.
Sample script :
function createTrigger(){
ScriptApp.newTrigger('sendMail')
.forSpreadsheet(SpreadsheetApp.getActive())
.onChange()
.create();
}
function sendMail() {
MailApp.sendEmail("### Your e-mail address ###", "test mail", "Spreadsheet was edited.");
}