我想在用户填写表单时自动通知我们网站上的Google表单,然后在简明的电子邮件中返回他们输入的数据。我不喜欢谷歌通知你它只是链接到你的表格来查看响应的方式。我在网上搜索并找到了这段代码:
function sendFormByEmailPrayer(e)
{
// Remember to replace XYZ with your own email address
var email = "admin@communionchapelefca.org";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "Prayer Form Form Submitted";
// The variable e holds all the form values in an array.
// Loop through the array and append values to the body.
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var urlToDoc = SpreadsheetApp.getActive().getUrl();
var body = "";
body = body + "Link to Document: " + urlToDoc;
var message = body + "\n\n" + "";
// Credit to Henrique Abreu for fixing the sort order
for(var i in headers)
message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "\n\n";
// This is the MailApp service of Google Apps Script
// that sends the email. You can also use GmailApp here.
MailApp.sendEmail(email, subject, message);
// Watch the following video for details
// http://youtu.be/z6klwUxRwQI
// By Amit Agarwal - www.labnol.org
}
它在我的一个表单上运行得很好,但是当我将这个工作代码复制并粘贴到我们的其他6个表单时,它根本不起作用。如何在7种表格中使用它?提前谢谢。
答案 0 :(得分:0)
我找到了比上面提到的代码更好的解决方案。如果您使用新的Google表单,则可以添加“加载项”(右上角的YourForm - >三个点 - >加载项)。
从那里查找"Simply Send"它会自动通过电子邮件发送带有标题的回复。我花了大约5秒来设置我的每个表格。