I am trying to onEdit
multiple values in the same sheet yet based on the script it will only edit the last value referenced (in this case "Withdrew - Onsite").
How do I write the script so that if any of these values are selected in the dropdown menu off this column, Sheets will hide that row also?
IE: var VALUE = "Rejected - Coding Interview" OR var VALUE = "Rejected - Manager Screen" OR var VALUE = "Rejected - Onsite";
, etc.
var SHEET = "Candidate_Funnel";
// The value that will cause the row to hide.
var VALUE = "Rejected - Coding Interview";
var VALUE = "Rejected - Manager Screen";
var VALUE = "Rejected - Onsite";
var VALUE = "Rejected - Recruiter Screen";
var VALUE = "Withdrew - Coding Interview";
var VALUE = "Withdrew - Manager Screen";
var VALUE = "Withdrew - Recruiter Screen";
var VALUE = "Withdrew - Onsite";
// The column we will be using
var COLUMN_NUMBER = 1
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
//Ensure on correct sheet.
if(SHEET == activeSheet.getName()){
var cell = ss.getActiveCell()
var cellValue = cell.getValue();
//Ensure we are looking at the correct column.
if(cell.getColumn() == COLUMN_NUMBER){
//If the cell matched the value we require,hide the row.
if(cellValue == VALUE){
activeSheet.hideRow(cell);
};
};
};
}
Logger.log(e)
and learn about what the event object provides you for no additional effort and no additional function call. It can save you a lot of time as well which is important because simple triggers must complete in 30 seconds. – Cooper