4
votes

If I create a Google apps script, can I hook it up to Google spreadsheet to run based on an event, or must I manually invoke it?

I don't know if Google Sheets supports any events.

For example: a Google app script that strikes out rows in the spreadsheet that have been marked completed by way of a column having the digit 1 beside completed rows. I would like this to run whenever a row is modified, or even when the spreadsheet is first loaded.

1
Removed google-app-engine tag, as this question is not actually related to AppEngine in any way.Adam Crossland
@Adam C: Thanks, I was unsure when I posted that tag - figured somebody else would know the diff and correct it if need be.John K

1 Answers

3
votes

The function onOpen() is automatically executed every time a Spreadsheet is loaded. In the future, we will expose a general event API, but until then you can simply define your own function as long as it is called onOpen().
From the Section 2 of the Tutorial

There is also function onEdit() as can be viewed in at:

http://www.google.com/support/forum/p/apps-script/thread?tid=584a17c79e4c04d5&hl=en

It seems that event handling is in flux and dependent on security issues being worked out.