我正在尝试使用Google Script从电子表格中向in-cell dropdown list
添加一些值,但我无法使其正常运行......
这是我的代码:
var justRS = rs.report_suites;
var rsID = [];
for(var prop in justRS) {
rsID.push(justRS[prop].rsid);
}
var cell = SpreadsheetApp.getSheets()[4].getRange("A1");
var rule = SpreadsheetApp.newDataValidation().build();
cell.setDataValidation(rule).setValue(rsID);
细胞" A1"应包含in-cell dropdown list
,其值为rsID
数组...
答案 0 :(得分:1)
解决了,这是解决方案:
var cell = SpreadsheetApp.getActiveSpreadsheet().getSheets()[4].getRange("A1");
var rule = SpreadsheetApp.newDataValidation().requireValueInList(rsID, true).build();
cell.setDataValidation(rule);