gpt4 book ai didi

javascript - 类型错误 : Cannot read property "namedValues" from undefined.(第 9 行,文件 "Code")

转载 作者:行者123 更新时间:2023-11-28 06:42:20 26 4
gpt4 key购买 nike

试图找出我哪里出错了。我不是编码员,但正在重复使用我用过的另一个 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);
}

非常感谢!!安德鲁

最佳答案

您传递给函数的数据无效,因此您无法调用它的属性。这基本上就像尝试调用 undefined.namedValues

您可能想检查函数的调用位置。

关于javascript - 类型错误 : Cannot read property "namedValues" from undefined.(第 9 行,文件 "Code"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33682699/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com