尝试在表单完成后启动一个简单的脚本来发送收据

时间:2013-10-23 13:29:09

标签: google-apps-script google-form

好的,好的。我写了一个简单的脚本,向在Google文档上完成表单的任何人发送电子邮件。问题是,我无法让它运行,我只有胆量让用户发送电子邮件并向他们发送电子邮件。我无法启动脚本。一旦表单完成,我已经看了很远,试图找到一种自动启动脚本的方法。

Tl; dr 尝试发送确认表格已完成的收据。

这是脚本:

function hallpassreceipt() {

  // Get the email address of the active user - that's you.
  var email = Session.getActiveUser().getEmail();

  // Get the name of the document to use as an email subject line.
  var subject = 'Hall Pass';

  // Append a new string to the "url" variable to use as an email body.
  var body = 'This is a hall pass .';

  // Send yourself an email with a link to the document.
  GmailApp.sendEmail(email, subject, body); }

1 个答案:

答案 0 :(得分:0)

阅读Understanding Triggers

您需要设置一个Installable Form Response触发器。一个例子:Google Script to email form answers and questions to a user