4
votes

I created an onEdit() trigger in Google App Script, but it only works when I change the value of a cell; not when I change the background color. How can I fix it?

1
How does the background color change? From code? User changes it?Alan Wells
Thanks guys, I suspected kind of that. I was just hoping from 2012 till 2015 google team had made some progress in that! The color is user changed.Daniele

1 Answers

3
votes

NOTE: There is an open issue about onChange(e) to report that it's not working. See Google script onChange event doens't fire anymore


Instead of using onEdit(e) use onChange(e). When the background of a cell be changed, the value of e.changeType will be FORMAT.

function onChange(e) {
   // Show a popup with a message showing the type of change.
   SpreadsheetApp.getActiveSpreadsheet().toast(e.changeType);
}

References