我已經使用了遍佈網絡的多個腳本,並且遇到了同樣的問題。我有幾個谷歌文檔的形式,我需要通過電子郵件接收提交的數據(不只是通知表單已提交和相應的電子表格已更新)。這個劇本是工作,但已經停止由於某些原因:在電子郵件中接收Google文檔表單數據
function sendFormByEmail(e)
{
// Remember to replace XYZ with your own email address
var email = "[email protected]";
// 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
}
對此我收到一個錯誤:類型錯誤:無法從不確定的讀取屬性「namedValues」。 (第20行)
我什麼也沒有改變,現在我找不到任何表單提交到電子郵件腳本工作。誰能幫忙?