3

Is it possible to create a brand new google app script programmatically and attach him to a specific google doc?

Or in any other way, to make 1 bound script and make several google docs to share him as the same bound script?

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Jumpa
  • 878
  • 1
  • 8
  • 12
  • 4
    A good Stack Overflow question includes an explanation of what you have already tried. It *is* possible to programmatically create a new Apps Script file with content. Even though the original script is bound, I believe that it can still be used as a library in other Apps Script files. And an add-on can do that also, but it's better to have a stand alone Apps Script file as the basis for an add-on or library. I believe that the new Apps Script API can deploy scripts and new versions. But you are asking a very broad question. – Alan Wells Jul 04 '18 at 15:13

1 Answers1

4

Yes. Possible through the API.

Use project.create. You can provide a project title. You can also create a bound script by providing the Google Drive ID of a Google Doc, Sheet, Form, or Slides file to act as the script's parent.

clasp is an open-source tool, separate from the Apps Script platform, that lets you develop and manage Apps Script projects from your terminal rather than the Apps Script editor.

TheMaster
  • 45,448
  • 6
  • 62
  • 85