我写过这个谷歌应用程序脚本.目的:每次编辑"位置更新"脚本时,都应向"经纪人电子邮件"发送电子邮件. 这是电子表格的链接:
function onEdit(e) {
var activateSheet = SpreadsheetApp.getActiveSpreadsheet();
SpreadsheetApp.setActiveSheet(activateSheet.getSheetByName('Responses'));
var sheet = SpreadsheetApp.getActiveSheet();
var range = e.range;
var row = e.range.getRowIndex();//Gets the row the change was made to.
var timestamp = sheet.getRange(row, 1).getValues(); //Gets the email
var load = sheet.getRange(row, 2).getValues(); //Gets the email
var email = sheet.getRange(row, 3).getValues(); //Gets the email
var location = sheet.getRange(row, 4).getValues(); //Gets the email
var template = HtmlService.createTemplateFromFile("template");
template.load = load;
template.location =location;
MailApp.sendEmail(email,"Hi","this is my email",{htmlBody: template.evaluate().getContent()});
}
Run Code Online (Sandbox Code Playgroud)
<html>
<h1><b>This is …Run Code Online (Sandbox Code Playgroud)