onEdit(e) which is used for the Edit event on Spreadsheet has the old value as e.oldValue. The specifications for this are as follows.
- When an user edited a single "A1" cell,
eofonEdit(e)showshogefore.oldValueandfugafore.value. - When an user edited the "A1:A2" multiple cells,
e.oldValueande.valueofonEdit(e)are not shown anything. - When an user copied and pasted from other cell,
e.oldValueande.valueofonEdit(e)are not shown anything.
This sample script was created to retrieve both the edited values and the old values for the range of edited cells. This is the modified e.oldValue.