In this article:

How to Add Google Sheets Radio Buttons (2024 Update)

February 5, 2024

In this article we will show how to give a list of checkboxes the same functionality as radio buttons in google sheets with apps script.

Add Google Sheets Radio Button

1. Format The Sheet And Add Checkboxes

First, format the sheet and add checkboxes in the process. For example, we have the following sheet below where we will add checkboxes to the range B2:E6. 

Sheet to add radio button in google sheets

To add the checkboxes, select the range.

Selected range of sheet to add radio button in google sheets‍

After selecting the range, click Insert then select Checkbox

Click insert, select checkbox to add radio button in google sheets

The checkboxes are now inserted.

Checkboxes to be converted to radio button in google sheets

By default, you can tick two or more checkboxes along the same row at the same time. We want to modify this behavior by using a custom script to, thus making Google Sheets clear the other checkboxes when a new one along the same row is ticked. This will give us the same functionality as a radio button in our google sheet.

2. Click Extensions, then Select Apps Script

We insert the script through Google Apps Script. Click Extensions, then select Apps Script.

google sheets radio button, click extensions, select apps script‍

A new tab will load containing Google Apps Script.

google sheets radio button, google apps script

3. Paste the Script

Copy the following script, taken from Ben Collins:

/**
 * onEdit to uncheck checkboxes as required
 */
function onEdit(e) {
  // get event object data: sheet name, row number and column number
  const sheet = e.range.getSheet();
  const row = e.range.rowStart;
  const col = e.range.columnStart;

  switch(col) {
    // case when column B is checked
    case 2:
      sheet.getRange("C" + row + ":E" + row).uncheck();
      break;
    // case when column C is checked
    case 3:
      sheet.getRangeList(["B" + row,"D" + row + ":E" + row]).uncheck();
      break;
    // case when column D is checked
    case 4:
      sheet.getRangeList(["B" + row + ":C" + row,"E" + row]).uncheck();
      break;
    // case when column E is checked
    case 5:
      sheet.getRange("B" + row + ":D" + row).uncheck();
       break;

    // cell is outside of columns B to D
    default:
      return;
  }
}
  

Go to the Apps Script tab, clear the code area, then paste the script.

google sheets radio button, google apps script with the code‍

Click the Save project button. 

google sheets radio button, click save project button‍

4. Run the Script

We can now run the script. Click Run the selected function.

Run the selected function to make the radio button google sheets work

The Execution log will appear, and you will get an error. It is fine. 

radio button google sheets, initial error in running the script

5. Use the Sheet

Go back to the tab containing the Google Sheet, and start ticking the checkboxes. You will notice that when you tick another checkbox along a row with a checkbox already ticked, the previously-ticked checkbox will be unchecked. 

Radio button google sheets in action‍

Congratulations! You are able to implement the script very well.

FAQs

What if I only have three choices per row?

Let’s say you want to add choices on Columns B, C, and D only. You only need to modify the script a bit. You can copy the script below:

/**
 * onEdit to uncheck checkboxes as required
 */
function onEdit(e) {
  // get event object data: sheet name, row number and column number
  const sheet = e.range.getSheet();
  const row = e.range.rowStart;
  const col = e.range.columnStart;

  switch(col) {
    // case when column B is checked
    case 2:
      sheet.getRange("C" + row + ":D" + row).uncheck();
      break;
    // case when column C is checked
    case 3:
      sheet.getRangeList(["B" + row , "D" + row]).uncheck();
      break;
    // case when column D is checked
    case 4:
      sheet.getRangeList(["B" + row + ":C" + row]).uncheck();
      break;

    // cell is outside of columns B to D
    default:
      return;
  }
}
  

The script can be copied from the link below:

https://github.com/rvbautista/radio-buttons-google-sheets/blob/main/README.md 

And you will get the following result:

google sheets radio button on three columns in action

What if the Checkboxes are in Different Columns?

Then you need to edit the script itself. Check the link below for a guide to editing the script to accommodate other columns.

https://github.com/rvbautista/radio-buttons-google-sheets/blob/main/README.md

We hope this article has helped you and given you a better understanding of how to add radio buttons in Google Sheets. You might also like our articles on how to make a button in Google Sheets and how to use Google Sheets named ranges.

To optimize your workflow, we recommend reading our guide on how to attach a Google Sheet to an email and trying our software for managing payment due reminders.

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.
Get your copy of our free Google Sheets automation guide!
  • 27 pages of Google Sheets tips and tricks to save time
  • Covers pivot tables and other advanced topics
  • 100% free

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->