I have a spreadsheet that has multiple editors. I get a list of all users separated by comma using:
var users = ss.getEditors().toString();
Rather than having a list of users separated by comma, which looks ugly (I have 100+ users), I would like to set up a drop down menu to view users. To do that, I have written this:
function Dropdown() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var TestSheetName = "Test"
var TestSheet = ss.getSheetByName(TestSheetName);
var users = ss.getEditors().toString();
TestSheet.getRange(1, 1).setDataValidation(SpreadsheetApp.newDataValidation()
.setAllowInvalid(true)
.requireValueInList([users], true)
.build()
);
}
The drop down menu created shows the list with commas. What is bizarre is when I right click on the cell and go to "Data Validation," I can see that the users are put in correctly. When I then click 'OK' to close the menu, the dropdown corrects itself and I have the list of users correctly formatted.
Am I doing something wrong with my code? Or is this a bug?
Appreciate your insights.