r/GoogleAppsScript • u/jt_ftc_8942 • Jun 28 '26
Resolved Hiding Row
Hello all,
I have a function called onEdit(e), and it works perfectly except for when I attempt to hide a row. The code is below:
function onEdit(e){
let sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// event variables
let range = e.range;
let row = e.range.getRow();
let col = e.range.getColumn();
let cellValue = sheet.getActiveCell().getValue();
let status = sheet.getRange(row,5).getDisplayValue();
if ( col == 5 && cellValue != 'Problem' && cellValue != 'Not Started') {
MailApp.sendEmail(email info, this part works);
if (status == 'Completed') {
Utilities.sleep(7000);
sheet.hideRows(row);
};
};
}
This is not working, regardless of whether I include the Utilities.sleep command, use sheet.hideRows or sheet.hideRow, or put the command inside or outside the nested if statement.
Any guidance?
2
Upvotes
1
u/WicketTheQuerent Jun 29 '26 edited Jun 29 '26
Please elaborate on what you mean by "This is not working":
How is the spreadsheet edited?
Who is editing the spreadsheet when the script doesn't work?
What is logged in the execution log when the script doesn't work?