File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,23 @@ function onEdit(e) {
24
24
}
25
25
// [END apps_script_triggers_onedit]
26
26
27
+ // [START apps_script_triggers_onselectionchange]
28
+ /**
29
+ * The event handler triggered when the selection changes in the spreadsheet.
30
+ * @param {Event } e The onSelectionChange event.
31
+ */
32
+ function onSelectionChange ( e ) {
33
+ // Set background to red if a single empty cell is selected.
34
+ var range = e . range ;
35
+ if ( range . getNumRows ( ) == 1
36
+ && range . getNumColumns ( ) == 1
37
+ && range . getCell ( 1 , 1 ) . getValue ( ) == "" ) {
38
+ range . setBackground ( "red" ) ;
39
+ }
40
+ }
41
+ // [END apps_script_triggers_onselectionchange]
42
+
43
+
27
44
// [START apps_script_triggers_oninstall]
28
45
/**
29
46
* The event handler triggered when installing the add-on.
You can’t perform that action at this time.
0 commit comments