0
votes

I use an OnEdit function to move data to another sheet whenever a changed in a particular column. But The change should happen with a formula. But, it is not working.

example : When I change A1 to "ok" manually the OnEdit function work, but when the A1 cell change through an If condition to "ok" it's not moving and there is no movement.

Can you help me work the Onedit function without a human interfere?

1

1 Answers

1
votes

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: