English 中文(简体)
窗体编辑后发送电子邮件
原标题:Send Email after Form is Edited

我有一个Google表格,它很好用。在这个表格里,我还写了剧本,发送电子邮件。这些剧本也很好用。

我所没有的是一种让这些脚本触发并自行运行的方法。 目前, 当表格被编辑时, 我收到一个通知电子邮件。 然后我要登录到电子表格中, 手动运行我的电子邮件脚本 。

我希望电子表格能自动运行脚本, 并在从窗体中添加数据时发送电子邮件。 我尝试了下面的 Edit, 但只有在我打开了电子表格并启动它时才有效 。 在对表格进行编辑而无需打开之后, 是否有另一种方法可以自动运行脚本?

这是基本的电子邮件代码+我的Edit,我想工作。

// Ran when the spreadsheet is edited
function onEdit(){ 
  emailEOnEdit();
}

// Sends an email when the New User Request Form is edited
function emailEOnEdit(row){ 
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var subject = "Test Email On Edit";
  var recipients = "[email protected]"
  var message = "<HTML><BODY>" 
    + "<P>" + sheet.getRange("E1").getValues()
    + "</HTML></BODY>"; 
  MailApp.sendEmail(recipients, subject, "", {htmlBody: message});
}
最佳回答

您是否尝试过 < a href=> "https:// developmenters.google.com/apps-script/ guide_events #TriggerAtfriendtes" rel=“ no follow” > in FormSubmit 触发器?

问题回答

暂无回答




相关问题
How to use year counter google app script?

I need an urgent help i have data as follows in a google sheet i need to add a year counter to the column d as follows using google apps script

What is the daily email limit in Google Apps Script?

Can someone tell me if there is a webpage that lists the official Google limit (Quotas) on emails sent from a Google Apps Script? In testing my little script I got an error: Service invoked too many ...

Reference Error for property of Javascript Object

I have built an object in Javascript on the Google Apps Script engine and every time I run my script I get a reference error saying uName is not defined. Here is the relivant code: function DataSet()...

Run Google Apps Script on Google-Spreadsheet event?

If I create a Google apps script, can I hook it up to Google spreadsheet to run based on an event, or must I manually invoke it? I don t know if Google Sheets supports any events. For example: a ...

Google gadget/spreadsheet: Grab spreadsheet key for gadget

So I m working on a google gadget(really only gadgetizing so I can get a datastore for this) that I want to be embeddable in a google spreadsheet (after this point, I m going to skip the word google - ...

热门标签