我已经使用 googledocs 设置了一个表单。我只想将实际数据输入到通过电子邮件发送给我的表单中,而不是一般的回复建议表单已完成。
我没有代码等方面的技能或经验,但我确信我可以解决这个问题。我已经花了几个小时,但没有任何运气。
我的表单非常基本。它有 5 个字段。其中 4 个只是文本回复,还有一个多项选择。
我在网上找到了这个 tute (http://www.labnol.org/internet/google-docs-email-form/20884/),我认为它总结了我正在尝试做的事情,但无法得到它上类。
从这个网站我输入了以下代码:
function sendFormByEmail(e)
{
var email = "reports.mckeir@gmail.com";
var subject = "Google Docs Form Submitted";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
for(var i in headers)
message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "\n\n";
MailApp.sendEmail(email, subject, message);
}
对此,我得到以下回应:->
Your script, Contact Us Form Mailer, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.
该脚本由文档 100% Club 使用。
细节:
Start Function Error Message Trigger End
12/3/12 11:06 PM sendFormByEmail TypeError: Cannot call method "toString" of undefined. (line 12) formSubmit 12/3/12 11:06 PM
有没有人能帮我解释一下?我猜我没有包括一些需要的数据,但老实说我不知道。
最佳答案
解决方法 http://www.labnol.org/internet/google-docs-email-form/20884/
您必须设置应用程序脚本才能将数据作为电子邮件转发。
关于email - 设置脚本以在电子邮件通知中包含 google docs 表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13683060/