0

I've searched through several previous posts about related questions to mine, but I may simply not have understood it fully.

I built a library and linked it to multiple sheets. The idea is to have any changes pushed to the scripts in those sheets whenever I change a line in the library, rather than having to edit each sheet's script. When testing it while logged in under the account I created the library and sheets in, the code works as it should. However, once I shared the sheet for someone else to run, none of the functions in the library work for them. I've checked my scripts in each sheet carefully to ensure it's properly calling the library, as seen below along with the error.

function onOpen() {
  return terr.onOpen();
}

TypeError: terr.onOpen is not a function at onOpen(Code:6:15)

I've read about using add-ons, but I'm not sure if this is the answer, or how to implement it if it is. I appreciate any help you can give!

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Tom17
  • 11
  • 1
  • 1
    Try sharing the library to them as well. Also show your full code. – TheMaster Dec 30 '20 at 06:55
  • @TheMaster Thanks so much! I had shared the library with other users, but only in View mode. When I changed it to Editor, they were able to run the functions as intended. I'm glad it works, but I imagine this now exposes the code to them. I wouldn't want them to edit it by mistake...is there a way to prevent that? – Tom17 Dec 30 '20 at 19:21
  • A library should be a standalone script and not bound to a container. Is that true for your library? Officially, view access should be enough. Not sure what's going wrong in your case. – TheMaster Dec 30 '20 at 20:02
  • @TheMaster In script.google.com, I had created a new Project and built the library there. Each sheet then references it as a library. I'll try to set it back to View only and see if it will still work. Is there anything else I should verify? – Tom17 Dec 30 '20 at 20:16
  • Maybe related: https://stackoverflow.com/a/63907324/ – TheMaster Dec 30 '20 at 20:48

0 Answers0