Reputation: 59
Thanks in advance for your help ...
I need to run a script upon editing just a single cell in a specific sheet.
A new row is first appended to the bottom of the dataRange.
The user first selects a date from a datePicker in Col A and then selects an entry from a list (using Data Validation) in Col B.
The idea is to use the textFinder to find the first previous row that matches the selected list item in Col B so that other cells on the new row can be populated from the found matched row.
All is working well except for the trigger.
Any ideas on how to trigger the script would be gratefully received!
Upvotes: 1
Views: 629
Reputation: 15377
You can use an onEdit(e) trigger containing a conditional which only executes if a certain cell has been edited.
You can run whatever script you like on the edit of a specific cell by first checking the range of the edit using the event object:
function onEdit(e) {
if (e.range == 'A1') {
// put the code you want to run here
}
// you can put additional else if statements here if you want other code to
// execute on other cells being edited
else {
return;
}
}
Make sure to run the script manually one time first so that you can authenticate!
Upvotes: 1