0
votes

I was running Google Sheets with only 1 Sheet and this script (updating timestamp onEdit)

function onEdit(e) {
    if (!e.value) return;
    e.source.getActivesheet()
        .getRange('G50')
        .setValue(new Date());
}

but as soon as I added 2 additional sheets, it stopped working. I dont get it, because I thought, this script will now run on either of these sheets as soon as I edit on. (but it does nothing)

What am I not thinking about? Thanks for help in advance.

1

1 Answers

0
votes

How about a change as follows?

From :

e.source.getActivesheet()

To :

e.source.getActiveSheet()

In the case of onEdit(), even when an error occurs, the error doesn't display. So if you want to know whether the error occurs, please confirm "View > Execution Transcript" on Script Editor after onEdit() was launched. You can see the running process of onEdit() in the Execution Transcript.