Last active
April 9, 2022 16:53
-
-
Save erickoledadevrel/0d91efe823010a6747facc0ab708f119 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