1
votes

Google recently made available its new Google Script API, and I think it is a good opportunity to make a long awaited project happen.

The context is as follows:

  • A few users, all in a corporate GSuite domain share ~100 sheets, that have the same purpose.

  • I would like to augment these sheets with a sidebar, that displays additional information, etc.

  • I want to process to be seamless for the users (ie. no installation, and auto-open when on one of the sheets in the project).

These last requirements force me to use a bound script, bound to each and every file in the project. So far, making sure every sheet had the same script was very difficult, and I gave up.

However, the newest API gives me hope. I have looked at the documentation, but it does not really say one way or an other, hence my question:

Can I deploy bound scripts using Google Script API?

2
Do you want to create a project of bound script type in Spreadsheet? If my understanding is correct, it can be achieved using projects.create Apps Script API. But I'm not sure whether this works and is useful in your environment. It is required to try. If I misunderstand your question, I'm sorry. - Tanaike
Hello @Tanaike, thank you for your help. projects.create is definitively half of the solution. The other half would be retrieving the project created later on, from the Google Sheet's ID, but it seems that projects.get can only use a project ID... Any idea? - Maxime
Thank you for your reply. Unfortunately, in the current situation, the project in the spreadsheet cannot be retrieved using Apps Script API. Because "projects.get" doesn't return the parent ID (in your situation, Spreadsheet ID). Although I think that this might be a bug, I'm not sure the detail. So I reported this situation to issuetracker.google.com/issues/71941200 - Tanaike

2 Answers

0
votes

It should be possible (for the most part).

You might run into a few issues with automatically opening the sidebar but everything else seems viable.

You just have to write a script to fetch the file Ids of the 100+ sheets in question, set up a stand-alone or bound script as the master copy, and use the api's projects::getContent() method to get the script files from the master and propagate that to the target sheets using the projects::updateContent() method. You'd probably also need to create new projects for bound scripts on those sheets using the projects::create() method.

0
votes

The docs states that you can publish your scripts (bound or standalone) as Add-ons. That's the most possible direction you're headed.

Apps Script lets you publish your script as an add-on so other users can install it from the add-on store.