Issue:
As you can see in the official documentation:
onEdit(e)
runs when a user changes a value in a spreadsheet.
That is to day, this trigger does not track changes that are made programmatically:
Script executions and API requests do not cause triggers to run. For example, calling Range.setValue()
to edit a cell does not cause the spreadsheet's onEdit trigger to run.
Workaround:
A possible workaround to this limitation is to have a time-driven trigger instead. You could, for example, have a trigger that will fire every minute, disregarding whether the spreadsheet was edited or not.
Then, inside the triggered function you could think of a way to check if the spreadsheet was edited during the last minute (for example, have the previous values stored in another sheet, or in a script property, and compare them to the current ones), and execute your desired actions if that's the case.
Reference: