so I’m a beginner to Apps Script. I’m currently trying to create a dropdown on Google Sheets so that users can select multiple options from the drop down. The code I currently have is below, and works well for one cell. However, I was wondering if there was a way to expand on it so that it could be applied to an entire column of cells. (visa vi: I don’t have to make a new script for each individual cell I want to use).
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeCell = ss.getActiveCell();
if(activeCell.getColumn() == 6 && activeCell.getRow() == 14 && ss.getActiveSheet().getName() == "Film Festivals") {
var newValue = e.value;
var oldValue = e.oldValue;
if (!newValue) {
activeCell.setValue("");
} else {
if (!oldValue) {
activeCell.setValue(newValue);
} else {
activeCell.setValue(oldValue + ',' + newValue);
}
}
}
}
New contributor
Mike Richards is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.