Reputation: 622
I have a spreadsheet with few tabs in it and i want to trigger my onEdit
script only if one tab was edited.
How can i from script define on which tab it is triggered?
Upvotes: 0
Views: 99
Reputation: 1414
You can use the event object to find the edited range, then use the range to find the sheet, then check that the sheet's name matches the one you want;
function onEdit(e) {
var sheetName = e.range.getSheet().getName();
if (sheetName === 'yourSheetNameHere') {
//do something
}
}
Upvotes: 1