Importing/loading scripts

141 views
Skip to first unread message

Eric Aiken

unread,
Sep 14, 2023, 2:56:59 PM9/14/23
to Google Apps Script Community
Sorry If I'm being dense, but It can't be this hard to get some script code into apps script.

I can type code in, but I can't paste or load code from a file. 

Do I really need to setup a respository to push code into a google developer environment?

Thanks for any feedback.



Andrew Roberts

unread,
Sep 15, 2023, 5:19:19 AM9/15/23
to google-apps-sc...@googlegroups.com
True, you can't load code from a third-party file, you'd have to pull from a repo using something like the GitHub Chrome Extension or clasp.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/28930d28-8f05-4bfe-b41d-1c3ec3b9c336n%40googlegroups.com.

Eric Aiken

unread,
Sep 16, 2023, 12:14:42 PM9/16/23
to Google Apps Script Community
Thanks for the confirmation.  More and more often I wishing I could provide feedback to google.  I'd really love to understand that logic.  I can cut and copy, but not paste.  I'm certain they had some logic, but it eludes me.
Message has been deleted

Peter Berkhout

unread,
Sep 16, 2023, 1:55:54 PM9/16/23
to Google Apps Script Community
Maybe a browser issue? I have no trouble pasting text/code in Apps Script.

Op zaterdag 16 september 2023 om 18:14:42 UTC+2 schreef eric...@gmail.com:

DimuDesigns

unread,
Sep 16, 2023, 1:57:08 PM9/16/23
to Google Apps Script Community
You can do that without setting up a repository. But now-a-days you have to leverage an API.

Back when you had the old Rhino based editor you could export a stand-alone project as a JSON file or import a stand-alone project from a JSON file. The downside was that back then we could not import/export the scripts of a container-bound script (the feature was only applicable to stand-alone scripts).

You can still export a standalone GAS project from the Google Drive GUI and get a JSON file. But you'll have to use the Google Drive API to import it back into a project. Here' some documentation for that:
https://developers.google.com/apps-script/guides/import-export
This method of importing/exporting standalone GAS projects via the Google Drive API is probably deprecated, since you won't find links to this information from the main documentation anymore. So use it with the understanding that support for this method could disappear without warning.

The modern way to do things is to leverage the Apps Script API, that is what CLASP uses under the hood. You can use it directly yourself without CLASP or setting up a repo. Plus it works for both container-bound and stand-alone scripts. Documentation for the API is linked below:
https://developers.google.com/apps-script/api/reference/rest
Reply all
Reply to author
Forward
0 new messages