0
votes

I created a Google doc template that uses Google script to add a menu option that runs onOpen(). The script works for my developer account, however, if I try to create a new file with the template outside of the account, the script doesn't run.

I have been pulling my hair out trying to get the script to run when other users access it. I'm sure it is something easy.

Thanks for any help.

Edit: Here is a code snippet of what I am trying to do:

var ui = DocumentApp.getUi();

function onOpen() {  
  ui.createMenu('Publish')
      .addItem('Create Web file ', 'publishWebFile')
      .addItem('Create Bureau file', 'publishBureauFile')
      .addToUi();
}
1
Without knowing the code you use it's hard to give any clue about what could be happening... - Serge insas
This question appears to be off-topic because it is about a problem in the OP's environment, and is not generally helpful to other users. - Mogsdad

1 Answers

0
votes

I figured out the problem I was having with the script not working. A library was being used in the script that created the menu. While the document was shared with all users prior to be made into a template, the library script was not. I shared the library and the template was then able to access it and build the menu as expected.