Google Docs – Add Scripts or Add-Ons to New Document

google docsgoogle-apps-scriptgoogle-apps-script-add-ongoogle-sheets-addons

I've created a script or add on for my Google Document. The script exports the content to basic HTML.

When I create a new doc I can't find a way to import the scripts from the existing document. From the Google Document I have gone to Tools > Script editor. A blank script is created but I can't open or find any existing scripts.

Screenshot of my script and add-on:

Screenshot of my script and add-on

When I create a new doc and go to the script editor I can't find any to open?

no previous scripts to open

Best Answer

There are two basic categories of Apps Script files -

  1. Bound to the document (Sheet, Doc, Form)
  2. Stand Alone

Bound files do not show up in your Google Drive. Stand Alone Apps Scripts files do show up in your Google Drive.

You can create multiple projects inside of an Apps Script file, but projects in other files can not be searched or loaded into the code editor. So, you can't do what you want to do.

If you want to share an Apps Script file to multiple documents, you have two options.

  1. Library
  2. Add-on

A Library runs slower, and is not totally secure if you want to protect your code. An Add-on has a one-time $5 dollar fee to be able to publish the Add-on. The best option, in my opinion, is to use an Add-on from a stand alone Apps Script file.