hackpoetic
hackpoetic

Reputation: 165

Reusing Google Apps Script code between Sheets (Internal to company)

I work for a company that is very google-centric.

I want to reuse google apps script code between google sheets (but only specific google sheets). Only people within the company should have access to this script. When a copy of a google sheet with attached code is made, the code should copy (currently only the main file copies when I do this, for some reason). No other sheet should have this code attached.

Ideally, though I guess this may be unrelated, I want to store the code in our internal repository.

How would I do this?

Thank you!

Similar: Distributing Google Apps Scripts for Sheets in your company network (but I don't want it installed on all google sheets, just ones I chose and copies of those).

Upvotes: 3

Views: 1866

Answers (1)

Creating Custom Templates for your organization

If you are using Google Workspace with your organization. You could create a Google Sheet with the Apps Script code that you need and make it as a template for the domain/organization.

You should be able to make the template available for the organization and limit the users that can create or submit templates.

Add-ons with Custom Template (Apps Script)

You can also turn on the option to have templates with Add-ons, in case your project becomes one in the future when publishing the Apps Script project or deploying it as an Add-On for the organization.

This can also be considered as another alternative if you think about it. Building the Apps Script project and later publishing it as an Add-on as "Private"

There is an excellent thread discussing this particular scenario and also mentions the suggested libraries from the comments.

References:

Upvotes: 1

Related Questions