Insert a script into multiple Google Spreadsheets

google-apps-script, google-sheets

Solution

This was initially raised as a problem a while ago, and Google's solution was the "libraries" feature.

So you will want to

- You must save a version of your project. File > Manage Versions...

- Then go into File > Project Properties and copy the project key.

- Then in all other spreadsheets, you must go into the Script Editor and to go Resources > Manage Libraries. Then paste the project key from above and add it to that spreadsheet script.

There is not an automated way to accomplish this. In order to have a script run on any spreadsheet, you must go into the Script Editor for each spreadsheet.

Source

Problem

I am an amateur coder - I really only do a few things to make my life easier. I set up Google Forms and Spreadsheets for tracking discipline problems in different grades at my school. I wrote a short script that notifies the appropriate people by e-mail of any submission and that can filter and create reports about selected learners. Because I do DIY coding (English and French teacher, so I did not study programming), I often come up with some improvement that should have been obvious from the start. I really do not want to copy and paste the script improvement into every spreadsheet's script editor. I have copied this script as a stand-alone file in Google Drive but I cannot insert it into any of the spreadsheets because the gallery only has access to published scripts/apps. Is there a way around this? I've seen mentions of using libraries, but I have no clue even where to begin. It feels a bit silly that you can create a script as a stand-alone in Google Drive but not actually use it. Any help would be appreciated.

Original source

Related problems