![checkbox scriptcase checkbox scriptcase](https://www.scriptcase.net/docs/en_us/v81/comuns/campos/form/img/campo_check_vl_orig_lookup.jpg)
column C or D) then the range we want to uncheck is no longer continuous, so we use the getRangeList method to get two ranges in A1 notation (e.g. If the middle checkboxes are checked (i.e. C2:E2 or B2:D2) and use the uncheck method to uncheck any other checkboxes. column B or E) then we grab the continuous range on that row (i.e. If we click a checkbox on either end of the row (i.e. Then we use a switch statement to see if we clicked in column B, C, D, or E (i.e. You can see the lines that begin with e.range gather information about which Sheet we’re in and what the row and column coordinates of the checkbox are. which checkbox was clicked) to know which checkboxes to uncheck. It then uses the information from that event (i.e. It uses the onEdit trigger in Apps Script to react when the user checks a checkbox.
![checkbox scriptcase checkbox scriptcase](https://i0.wp.com/allpcworlds.com/wp-content/uploads/2022/01/ScriptCase-9.6-Full-Version.png)
Sheet.getRange("B" + row + ":D" + row).uncheck() Sheet.getRange("C" + row + ":E" + row).uncheck() get event object data: sheet name, row number and column number * onEdit to uncheck checkboxes as required Return to your Sheet to use the radio buttons.Select the onEdit function and run from within the Apps Script editor to authorize the script.
Checkbox scriptcase code#
To create your own radio buttons in Google Sheets, add this code to your Sheet: Talk to your G Suite administrator or try opening the file in an incognito browser.) Radio Buttons in Google Sheets (If you can’t open the file, it’s likely because your G Suite account prohibits opening files from external sources. To do this, open the script editor ( Tools > Script editor…), select the onEdit function and run from within the Apps Script editor to grant the necessary permissions.
Checkbox scriptcase how to#
Let’s see how to implement this with Apps Script.Ĭlick here to open the Radio Buttons in Google Sheets templateįeel free to make your own copy ( File > Make a copy…).īefore you can use the radio buttons, you need to authorize the script to run. It takes a split second: you can see the row turns orange when the checked checkbox count is briefly 2, but this is simply the script working in the background. You can see that when I check a new checkbox, any other checkboxes on that row are unchecked. Here are the radio buttons in Google Sheets in action: Since it’s impossible to create true radio buttons with checkboxes and formulas alone (although we can mimic radio button behavior with formulas), we use Apps Script to uncheck boxes as required. In other words, we’ll ensure that only one can be checked at a time. In this article, we’ll see how to make checkboxes in Google Sheets behave like radio buttons.