Run Google Apps Script on Google-Spreadsheet event?

google-apps-script, google-sheets, triggers

Solution

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.

Problem

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.

Original source