Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
You Google Apps triggers enable code to be executed in response to events such as editing the spreadsheet or on a timer. You set up a trigger in a spreadsheet by going as follows:
  1. Log into Google spreadsheets using the user: hdx.gapps.triggers@gmail.com from Logins.
  2. Go to the menu Tools -> Script Editor in the spreadsheet. This opens a new script editing window.
Copy
  1. Enter the code
below
  1. for your trigger into the Code.gs tab
, replacing the values of the variables in the top 3 lines (resource_idapi_key, prod_or_test which can be PROD or TEST depending upon the server you want to update).
  1. as a function.
  2. Then go to the Resources menu and select Current Project's Triggers. 
  3. Click on the link which says "No triggers set up. Click here to add one now." and set
it
  1. up your trigger as
follows
  1. desired using the dropdown menus
    Run: doOnEdit
    Events: From Spreadsheet | On edit
  1. , putting your trigger's function name under "Run".
  2. Click notifications and from the Execution failure notifications dropdowns, choose the
email
  1. hdx.gapps.triggers@gmail.com email you want to use and set when to notify as "immediately"
.

...

...

 is that it is not possible to see another person's triggers so multiple people could mistakenly create the same trigger on a spreadsheet.

Note that the hdx.gapps.triggers@gmail.com user only needs read access to the spreadsheet for the purposes of the trigger. Write access is only needed for adding the code for the trigger to the Script Editor (which can be completed with a different user). If the hdx.gapps.triggers@gmail.com user only has read access, you will not be able to open the Script Editor from the spreadsheet, you will need the direct url (which you can get by opening from the spreadsheet with another user that does have write access).

...

languagejs
titleResource and Datastore Triggers
collapsetrue

...

)

...

.

...