Use Checkboxes as Radio Buttons with the Properties Service

A follow-up to Use Checkboxes as Radio Buttons with FOR() Loop https://www.youtube.com/watch?v=FLyWXdA4FuA
Use Checkboxes as Radio Buttons using the Properties Service.

Important notes:
DO NOT run the script manually, it will fail.
Make sure the Property gets properly set on the first pass.

Sheet (to copy – go to File > Make a copy)
https://docs.google.com/spreadsheets/d/1wU-rlhVwPu4cMl1Aoef9ZZ4mRNeZQQYLcijFL4yzRAA/edit#gid=0

Script:
function onEdit(e){
if (e.range.columnStart != 2 || e.range.rowStart == 1 || e.range.rowStart > 8 || e.value != “TRUE”) return;
let r = PropertiesService.getScriptProperties().getProperty(“range”);
if (r == null){
PropertiesService.getScriptProperties().setProperty(“range”,e.range.getA1Notation());
return;
}
e.source.getActiveSheet().getRange(r).setValue(false);
PropertiesService.getScriptProperties().setProperty(“range”,e.range.getA1Notation());
}

Connect with me:
• spencer.farris@gmail.com
• spencerfarris.me
• www.linkedin.com/in/spencer-farris/
• Twitter @FarrisSpencer
• Google Product Expert support.google.com/docs/profile/12305

 

Leave a Reply

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