Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sheet Script onChange is triggered when cell value is changed

I add an onChange trigger to my Google Sheet via Tools->Script Editor -> Edit -> Current Project's trigger ->... I thought onChange is only triggered when the structure of data/sheet is changed, e.g., add or delete row and/or columns. However, the testing shows the onChange is triggered when cell value is changed as well.

So the onChange trigger behaves almost identical to the onEdit trigger. I am trying to avoid the onEdit trigger since it's triggered too often, which drags down the speed of Google Sheet.

Ideally, I'd like the onChange only being triggered when new rows and/or columns are added. Any help would be highly appreciated!

like image 840
Aruba Avatar asked Sep 12 '25 07:09

Aruba


1 Answers

Do something like this

function myOnchangeFunction(e) {
  if(e.changeType=='EDIT') {
    return;
  }
}
like image 191
Cooper Avatar answered Sep 14 '25 23:09

Cooper