试图找出我出错的地方。我不是编码员,但我正在重复使用我用过的另一张Google工作表中的代码。
我试图在提交填写此Google工作表的表单时触发发送的电子邮件。
以下是公开表:https://docs.google.com/spreadsheets/d/1oV8bwS_o7O-Wu5LXoP-0e9M71NpbQy-a0ViTSZhXJPA/edit?usp=sharing
以下是代码:
function FormSubmit(formData) {
// Load the sheets for processing
var responseSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Master Editing Sheet");
var supData = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Support Data");
// Create and send the Email
// Description is used to make the email
var description = supData.getRange(2,1).getValue();
var name = formData.namedValues["Prospects' Names"];
var timestamp = formData.namedValues["Timestamp"];
var to = "andrew.appel@gmail.com";
var subject = "New Prospect Submitted: " + name;
var message = "New Prospect | Submitted by | Initial Contact | Initial Notes: " + "\n" + "\n";
message += description + "\n" + "\n";
message += "The Master Recruitment Spreadsheet can be viewed by clicking on the following link" + "\n";
message += "https://tinyurl.com/recruitmaster"
MailApp.sendEmail(to, subject, message);
}
非常感谢!! 安德鲁
答案 0 :(得分:0)
您传递给函数的数据无效,因此您无法调用它的属性。它基本上就像试图调用undefined.namedValues
您可能想要检查函数的调用位置。