简体   繁体   English

TypeError:无法从未定义中读取属性“ namedValues”。 (第9行,“代码”文件)

[英]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.

相关问题 TypeError:无法从未定义中读取属性“值”。 (第9行,“代码”文件) - TypeError: Cannot read property “values” from undefined. (line 9, file “Code”) TypeError:无法从未定义中读取属性“ range”。 (第2行,“服务器”文件) - TypeError: Cannot read property “range” from undefined. (line 2, file “Server”) 无法从未定义中读取属性“ namedValues” - Cannot read property “namedValues” from undefined 当尝试在谷歌工作表脚本中使用 e.value 时,我得到 TypeError: Cannot read property "Values" from undefined。 (第 7 行,文件“代码”) - when attempting to use e.value in google sheet script I get TypeError: Cannot read property "Values" from undefined. (line 7, file "Code") “ typeError:无法读取未定义的属性“用户名”。” - “typeError: Cannot read property 'username' of undefined.” 未捕获(承诺中)类型错误:无法读取未定义的属性“0”。 从 csv 文件中提取以填充数组 - Uncaught (in promise) TypeError: Cannot read property '0' of undefined. Pulling from a csv file to populate an array TypeError:无法读取未定义的属性“长度”(第 13 行,文件“代码”) - TypeError: Cannot read property 'length' of undefined (line 13, file “Code”) TypeError:无法读取未定义的属性“ get”。 是npm的问题吗? - TypeError: Cannot read property 'get' of undefined. Is npm the issue? TypeError:无法读取未定义的属性“ 0”。 React Redux应用 - TypeError: Cannot read property '0' of undefined. React Redux App 未处理的拒绝(TypeError):无法读取未定义的属性“扩展”。 (GraphQL) - Unhandled Rejection (TypeError): Cannot read property 'extensions' of undefined. (GraphQL)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM