Uncheck All Checkboxes in Google Sheets

Unlike in Google Docs, unchecking checkboxes in Google Sheets with Script is extremely easy!

Without further ado, I am sharing you the script with only eleven lines of codes.

function uncheckAll() {

  const ss = SpreadsheetApp.getActiveSheet()

  const range = ss.getDataRange()

  range.uncheck()

}

function onOpen() {

  const ui = SpreadsheetApp.getUi()

  ui.createMenu(“Uncheck”)

  .addItem(‘All’,’uncheckAll’)

  .addToUi()

}

In your Google Sheets menu, click Extensions then Apps Scripts. It should open a new window that lets you enter a script.

After pasting above code, it should look like above screen shot. After pasting the code, you can then refresh your sheets. You should see a custom menu on your Google Sheets menu.

That Uncheck > All is our custom menu that let us run our uncheck code. When you click it for the first time, it will pop up an authorization page which you are required to run in order to use that piece of code.

Above code will uncheck all of your checked checkboxes regardless of columns. Like if you have checkboxes in COLUMN A and COLUMN E, it will uncheck all those checked.

Script Breakdown:

We have two functions, one is responsible for the actual unchecking and another one responsible for creating our custom menu.

function uncheckAll() {}

You can change “uncheckAll” to whatever name you like. This function is responsible for unchecking our checkboxes.

const ss = SpreadsheetApp.getActiveSheet()

This piece of code will access the current active sheet (tab) you are currently viewing. If you have a checkboxes in multiple tabs, then this code is perfect for you.

const range = ss.getDataRange()

This line of code gets all of the available range of your tab. .getDataRange() will ensure you will not missed a single checkbox.

range.uncheck()

After accessing the desired range, you can now use the uncheck() function. So, any checkboxes found in our range, it will uncheck all of it.

function onOpen() {}

This function will automatically run when we open our Spreadsheet. This is perfect for running the code that let us create our own custom menu.

The line of codes within our onOpen() function is pretty self explanatory so I do not want to waste your time with it.

Note: When you reload your sheet and the custom menu is not there, you can try to reload your sheet again after a minute. You can also manually run the onOpen function in the project editor in Extensions > Apps Script.

You can get a copy of the sheet here:

4 thoughts on “Uncheck All Checkboxes in Google Sheets”

  1. Appreciating the time and energy you put into your website and detailed information you offer.
    It’s good to come across a blog every once in a while
    that isn’t the same unwanted rehashed material.
    Excellent read! I’ve bookmarked your site and I’m
    including your RSS feeds to my Google account.

    Reply

Leave a Comment