gpt4 book ai didi

javascript - 错误: strictValidationFailed

转载 作者:行者123 更新时间:2023-12-02 19:36:39 25 4
gpt4 key购买 nike

我正在尝试从 doGet() 函数访问电子表格,该函数在从表单提交获取电子邮件的用户单击链接时执行。我认为我无法从 doGet() 调用 getActiveSpreadsheet 。因此,我通过链接发送了电子表格 ID 和行号,然后通过 openById 调用我需要的电子表格,但是当我这样做时,我收到一个奇怪的错误“strictValidationFailed”。就是这样,这就是关于错误的全部内容。它没有给出行号。或错误类型。看来自从我开始使用 openById 功能时开始出现此错误,该错误可能与此相关。我在下面附上了与​​此相关的代码片段。

function onFormSubmit(event) { //On form submission send an email to the approver. 
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var approvalsheet = spreadsheet.getSheetByName("Approval Worksheet");
//Get values that have to be put on the email.
var timestamp = event.values[0];
var username = event.values[1];
var campus = event.values[2];
var gltype = event.values[3];
var fullname = event.values[4];
var eMailAdd = event.values[5];
var description = event.values[6];
var replacement = event.values[7];
var usage = event.values[8];
var members = event.values[9];
var notes = event.values[11];
var initialowner = event.values[12];
//The service url that is required for approval on the email.
var serviceurl = //hiding the service URL
serviceurl+='&spreadsheetId='+spreadsheet.getId();
serviceurl+='&row='+approvalsheet.getLastRow();
//Setting the message that goes on the email sent to the approver.
var message = 'There is a new Submission to the UAF List or Group aprooval Workflow\n\n\n'+'You can aproove this request here: '+serviceurl+
'\n\nTime of Submission: '+timestamp+'\n\nSubmitter Username: '+username
+'\n\nCampus: '+campus+'\n\nFull Name: '+fullname+'\n\nMiddle Portion of Email Address: '+eMailAdd
+'\n\nDescription of the List/Group: '+description + '\n\nIs this replacing an existing eMail List or Group? '
+replacement+'\n\nUsage: '+usage+'\n\nAnticipated number of members: '+members+'\n\nBrief notes about the request :'
+notes+'\n\nAre you the initial owner :'+initialowner;
//Title for the mail sent.
var title = 'New Submission at '+timestamp;
//Email address for the approver that gets the submission notification.
var mailAdd = 'rssimon@alaska.edu'
//Sending Email to the approver.
MailApp.sendEmail(mailAdd, title, message);
}


function doGet(e) //On hitting approve button in the mail.
{
//retrieving spreadsheet ID from the approval link.
var spreadsheet = SpreadsheetApp.openById(e.parameter['spreadsheetId']);
//if (spreadsheet != null) {
var approvalsheet = spreadsheet.getSheetByName("Approval Worksheet");
//}
var row = e.parameter['row'];//retreiving row value that came from the approval link.
//if(spreadsheet!=null)
//{
approvalsheet.getRange(row, 17).setValue('Yes');//Setting the approval value on the spreadsheet to Yes.
approvalsheet.getRange(row, 17).setBackground('White');//Setting the approval box color to white.
//}
//Creating UiApp for approval notification.
var app = UiApp.createApplication(); //Create an instance of UiApp
var label = app.createLabel(); //Create a lable on the UiApp
label.setText('The list or group was approved');//Set text on the Label.
app.add(label);//Add label to the UiApp instance.
return app;
}

最佳答案

该错误似乎与电子表格中的数据验证有关。您能否检查以确保尝试写入电子表格的值没有违反任何数据验证规则?

关于javascript - 错误: strictValidationFailed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10858580/

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