I am trying to design a survey through google sheets and have set up some checkboxes, but noticed that there is some lag when changing selections/clearing previous selection. I was wondering if there is any way to modify the script or another way to set this up to minimize any lag.
Below is what I'm currently using:
function onEdit1(e) { var CHECKBOX_CELLS = ["A37", "A38", "A39", "A40", "A41", "A42","A43","A44"]; var range = e.range; var checkboxIndex = CHECKBOX_CELLS.indexOf(range.getA1Notation()); if (checkboxIndex > -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); } } }
I also tried the following, but I have 2 questions I need radio buttons for and using the below would only allow one selection across question 1 and 2.Question one has check boxes in cells A37-44 and Question two has them in A49-55
function onEdit(e){ if(e.source.getActiveSheet().getName() != "Sheet Name" || e.range.columnStart != 1 || e.value == "FALSE") return; for(var i = 37;i<45;i++){ if(i == e.range.rowStart) continue; e.source.getActiveSheet().getRange(i,2).setValue("FALSE"); } }}
Any guidance is much appreciated as I'm not familiar setting this up in google.
Thank you!