我使用了在网上找到的多个脚本,并且遇到了同样的问题。我有几个谷歌文档表单,我需要通过电子邮件接收提交的数据(不仅仅是表单已提交和相应电子表格已更新的通知)。该脚本可以正常工作,但由于某种原因已停止:
function sendFormByEmail(e)
{
// Remember to replace XYZ with your own email address
var email = "info.wchs@gmail.com";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "Google Docs 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 message = "";
// 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);
// By Amit Agarwal - www.labnol.org
}
我收到一个错误:TypeError:无法从未定义中读取属性“namedValues”。(第 20 行)
我什么都没做,现在我找不到任何表单提交到电子邮件脚本来工作。任何人都可以帮忙吗?