Use Checkboxes as Radio Buttons with a FOR() loop

Using a FOR() loop to make checkboxes behave as radio buttons.
Important notes:
DO NOT run the script manually, it will fail.
Make sure the array indexes and the Sheet rows match with some math.

Sheet (to copy – go to File, Make a copy)…

function onEdit(e){
if (e.range.columnStart != 2 || e.range.rowStart == 1 || e.range.rowStart ‘greater_than_sign’ 8 || e.value != “TRUE”) return;
let r = SpreadsheetApp.getActive().getActiveSheet().getRange(2,2,7);
let checks = r.getValues();
for (let i in checks){
if (checks[i][0] == true && +i != e.range.rowStart – 2)
checks[i][0] = false;

Connect with me:
• Twitter @FarrisSpencer
• Google Product Expert

Leave a Reply

Your email address will not be published. Required fields are marked *