Search code examples
google-apps-scriptgoogle-apps-script-editor

How to separate script editor from document (google apps script)


I'm writing some script for my Documents, Spreadsheets and Gmail. I would like to know if there is a way to save all my script to separate files in a specific google drive folder. I don't like having to go to the backend of my Documents and Spreadsheets in order to edit my script.

Would I have to call the document from my script using "getByID" or is there another way?


Solution

  • Yes, when you create a new document in Drive you can select Script. If you don't see the script option, try going here.

    You will, however, need to call your document using getByID. There my be other complexities if you are using onEdit type triggers.

    A lot more information can be found under the Types of Scripts heading at Google Apps Scripts Documentation.

    You could go advanced and pull your script in behind the Document as a Library and then using the script behind the Doc to make the calls to the library, but that's a bigger discussion.