I'm playing around with Google Apps script and encountering a weird error when trying to programmatically create a trigger (not bound to a specific file or anything).
I am trying to run a certain code - basically to edit a document in Google Docs whenever it opens, but I'm experiencing this error:
Unexpected error while getting the method or property create on object ScriptApp.DocumentTriggerBuilder. (line 9, file "Code")DetailsDismiss
Here's the code that I'm using:
/**
* Creates a trigger for when a spreadsheet opens.
*/
function createSpreadsheetOpenTrigger() {
var d = DocumentApp.getActiveDocument();
ScriptApp.newTrigger('myFunction')
.forDocument(d)
.onOpen()
.create();
}
function myFunction() {
// change the body or something...
}