I'm trying to hide rows if Column A is empty. I want to apply this to specific sheets (Week1, Week2, Week3, Week4 and Week5). This is the code I have so far for Week1.
function ConditionalHideRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Week1");
var condition = sheet.getRange("A:A").getValue();
if (condition = "EMPTY") {
sheet.hideRows(1,125)
}
EDIT: Bonus question, is there a way I can get it to unhide when Column A is filled? I'm using a =query formula to populate my spreadsheet and the length will need to change as more data is added.
To hide a row, right click on the row number on the left of the spreadsheet and choose Hide row. To hide multiple rows in a Google Spreadsheet, click on the first row and drag across the rows you wish to hide, or hold the Shift key and click on the last row you want to hide.
A third way to hide a row is to use the conditional formatting function. To hide a row using the conditional formatting function, select the row you want to hide and then click on the conditional formatting button in the toolbar.
Hide Blank Rows in Google SheetsOnce you insert the formula (=COUNTA(B2:E2)) in Column F, turn on the filter by going to Data > Create a filter. 2. To filter out zero values, (1) click on the filter icon in the F1 cell, (2) uncheck 0, and (3) click OK. All blank rows are now hidden.
If you want to hide rows based on cell values, you can do so by using a conditional formatting rule. To do this, select the rows you want to hide and then go to the Home tab > Styles group > Conditional Formatting > Highlight Cell Rules > A Date Occurring.
You don't need a formula for this, you can use a filter...
UPDATE: This should also work for your bonus question as well. Once the column is populated, it will no longer meet the filter conditions if "(Blanks)" is unchecked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With