Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google apps scripts button: can I assign a "global" script that's not attached to the worksheet? [duplicate]

I have a single script that I want to assign to a button on multiple different spreadsheets. If I create a button on the spreadsheets and reference the script, which is stored in another parent folder on Google drive, I get the error Script function myScript could not be found. I can resolve this by going into each sheet with the button, selecting tools, selecting Script editor, and then pasting my script there. The problem with this is that myScript depends on multiple other scripts, so for a dozen sheets, I'd have to copy over multiple scripts as described above to "attach" them to the spreadsheet and make them accessible via button. This is an obvious challenge for updating scripts in the future.

Is there a way for me to make my one project with all the scripts globally available, so I don't have to copy/paste the same scripts to every spreadsheet?

like image 733
Marion Avatar asked Sep 01 '25 16:09

Marion


1 Answers

What you can do is to create one script and use it as a library, whereby you would then proceed to attach that library to any individual instances where you would have your worksheets and so on.

Here's the basic idea: Google Developers Guide: Libraries

This is what I've been doing in any case.

like image 155
Aleister Tanek Javas Mraz Avatar answered Sep 06 '25 00:09

Aleister Tanek Javas Mraz