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?
Asked
Active
Viewed 3,321 times
4

Alan Wells
- 30,746
- 15
- 104
- 152

Daniele
- 359
- 7
- 15
-
3That's not possible, see: http://stackoverflow.com/a/11067652/1536038 – Jacob Jan Tuinstra Feb 20 '15 at 23:10
-
How does the background color change? From code? User changes it? – Alan Wells Feb 21 '15 at 05:15
-
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 Feb 21 '15 at 07:57
1 Answers
3
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

Rubén
- 34,714
- 9
- 70
- 166
-
-
1@X_Trust: There is an open issue about onChange(e). I added a note to my answer including a link to the issue. – Rubén Aug 30 '17 at 19:05