Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 如何禁用AllowInvalid应用程序内脚本?_Google Apps Script - Fatal编程技术网

Google apps script 如何禁用AllowInvalid应用程序内脚本?

Google apps script 如何禁用AllowInvalid应用程序内脚本?,google-apps-script,Google Apps Script,我有以下片段: let validationRule = SpreadsheetApp.newDataValidation().requireValueInList(DropDownList).build(); sheet.getRange(3,3,1,1).setDataValidation(validationRule); 我想设置为false,这样如果有人输入无效数据,单元格就必须拒绝它。在何处添加此getAllowInvalid(False)以实现我的目标。get顾名思义,仅检

我有以下片段:

let validationRule   = SpreadsheetApp.newDataValidation().requireValueInList(DropDownList).build();
  sheet.getRange(3,3,1,1).setDataValidation(validationRule);

我想设置为false,这样如果有人输入无效数据,单元格就必须拒绝它。在何处添加此
getAllowInvalid(False)
以实现我的目标。

get
顾名思义,仅检索
allowInvalid
配置。要设置,您需要在DataValidationBuilder上:

SpreadsheetApp //class: SpreadsheetApp
 .newDataValidation()//class: DataValidationBuilder 
 .requireValueInList(DropDownList)//class: DataValidationBuilder
 .setAllowInvalid(false)//class: DataValidationBuilder
 .build();//class: DataValidation