【发布时间】:2014-07-13 22:44:25
【问题描述】:
我正在尝试在提交表单并且信息填充电子表格时向我发送一封电子邮件。它昨天工作,但从那以后我得到的只是一个错误
7/13/14 5:23 PM sendFormByEmail 类型错误:无法调用方法 未定义的“toString”。 (第 20 行,文件“电子邮件脚本”)表单提交
function sendFormByEmail(e)
{
// Remember to replace XYZ with your own email address
var email = "lumbyb@gmatc.matc.edu";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "PC Repair Ticket";
// 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);
// Watch the following video for details
// http://youtu.be/z6klwUxRwQI
// By Amit Agarwal - www.labnol.org
}
【问题讨论】:
标签: google-apps-script google-sheets