I am completely new in writing scripts and I have just learned about Google Script Editor. I am currently trying to write one to automatically hide rows based on values on my spreadsheet. I managed to do it looking at various websites but I also want to unhide the rows if the value happens to change.
I'm new to this so I have copied the script I currently have but I think I have a problem in line 12 (the 'else' part).
function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var Sheet = ss.getActiveSheet();
var LastRow = Sheet.getLastRow();
for( i=1 ; i<=LastRow ; i++) { // i <= lastrow
var status = Sheet.getRange("A"+i).getValue(); // Change A to
the completed column
if (status == 0) { // status == 0
Sheet.hideRows(i);
else {
Sheet.unhideRows(i);
}
}
}
}
I would kindly like someone to help me with writing the correct code at the end to be able to unhide rows that were previously hidden based on values. I happen to work with data that's constantly changing and hiding/unhiding rows is very important to me. Thank you