2

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?

3
  • 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. Commented Feb 6, 2018 at 11:41
  • 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? Commented Feb 6, 2018 at 13:38
  • 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 Commented Feb 6, 2018 at 21:54

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your help. I have a question, related to the comments of the question. How would you get the projectId of the bound project (since projects::updateContent() requires a projectId) from the related sheetIs?
The method requires a scriptId, which is also returned in the JSON response when creating a project.
0

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.

1 Comment

Thank you for your answer. I would however prefer by far a solution where users don't have anything to do, it just works when they open a sheet that's part of the program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.