Please help me. I need a simple script for Google Sheets to allow only one of 6 checkboxes to be checked at a time
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
var range = e.range;
var CHECKBOX_CELLS = ["H1:H6"];
var checkboxIndex = CHECKBOX_CELLS.indexOf(range.getA1Notation());
if (activeSheet.getName() !== "TRIAL" VcheckboxIndex > -1 && range.getValue() == true)
{
var sheet = range.getSheet();
for (var i=0; i<CHECKBOX_CELLS.length; i++) {
if (i==checkboxIndex) continue;
sheet.getRange(CHECKBOX_CELLS[i]).setValue(false);
}
Aucun commentaire:
Enregistrer un commentaire