Home > Enterprise >  Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Range.se
Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Range.se

Time:07-14

I am making a very simple Code for Google App Script and when executing it I am getting the error mentioned in the title.
I use Google Sheets interchangeably in Spanish and English Language. I am wondering if this might generate a Configuration problem that I didn't figure out yet.
I have tried almost every form of possible Syntax regarding Arrays but none has worked.
Here is the CODE:

function myFunction() {
  var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('work');
  var list = ["A","B","C"];

  var rule = SpreadsheetApp.newDataValidation().requireValueInList(list).build;
  
  ws.getRange("B2").setDataValidation(rule);
}

CodePudding user response:

You forgot to include the parenthesis on build().

Replace

var rule = SpreadsheetApp.newDataValidation().requireValueInList(list).build;

With

var rule = SpreadsheetApp.newDataValidation().requireValueInList(list).build();
  • Related