[英]TypeError: Cannot read property “namedValues” from undefined. (line 9, file “Code”)
trying to find out where i'm going wrong. 试图找出我要去哪里。 I'm not a coder, but am re-using code from another google sheet I've used. 我不是编码人员,但正在重用我使用过的另一个Google工作表中的代码。
I'm trying to trigger an email being sent when a form is submitted that populates this google sheet. 我正在尝试触发填充此Google工作表的表单提交时发送的电子邮件。
Here is the public sheet: https://docs.google.com/spreadsheets/d/1oV8bwS_o7O-Wu5LXoP-0e9M71NpbQy-a0ViTSZhXJPA/edit?usp=sharing 这是公开的工作表: https : //docs.google.com/spreadsheets/d/1oV8bwS_o7O-Wu5LXoP-0e9M71NpbQy-a0ViTSZhXJPA/edit?usp=sharing
Here is the code: 这是代码:
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);
}
Thank you so much!! 非常感谢!! Andrew 安德鲁
The data that you are passing into the function is not valid so you can't call a property of it. 您传递给该函数的数据无效,因此无法调用其属性。 It is basically like trying to call undefined.namedValues 基本上就像尝试调用undefined.namedValues
You might want to check where the function is called. 您可能要检查调用该函数的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.