-
-
Save lordlycastle/e4a48a58cff9d534afd52c29226b35ea to your computer and use it in GitHub Desktop.
Google Apps Script code to hide a row when a checkbox is checked.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2019 Google LLC. | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
var CHECKBOX_COLUMN = 'B'; | |
function onEdit() { | |
var range = SpreadsheetApp.getActiveRange(); | |
if (range.getA1Notation().split(/\d/)[0] == CHECKBOX_COLUMN && | |
range.getValue() === true) { | |
var dv = range.getDataValidation(); | |
if (dv && dv.getCriteriaType() == SpreadsheetApp.DataValidationCriteria.CHECKBOX) { | |
range.getSheet().hideRow(range); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment