4
votes

I have an addon which makes use of appscripts (.gs) and also html, js and css files.

Currently what we do is we have a reference Google Doc, in which there is a script project which holds all this source code.

But there is no way to keep a copy of the source code in GIT, except manual copy and paste.

I found in another post that it is possible to download the whole project as a JSON, using the URL :

https://script.google.com/feeds/download/export?id=[project_id]&format=json

where [project_id] is accessible via File/Project Properties

That does for the export.

Question : is there a way to import such a JSON file in a Google docs script project ?

2
Check this article ramblings.mcpher.com/Home/excelquirks/drivesdk/… there is a lib to push code to github - St3ph
I checked GasGit as recommended above, but alas it only allows to extract scripts to github, but not to upload scripts from github to Google. So there is still no way to keep your sources in GIT, and publish them in an Appscript project in a document : the source code reference has to be at Google. If several documents are used for different environments (say dev and prod) then you're stuck with copying. - Yves Benigot

2 Answers

0
votes

Yes check this node project. I have been using it successfully to keep my code on git and push changes to my google drive where I can open the app scripts with the script editor (make sure to install it) and publish it as an addon

node-google-apps-script

0
votes

You can use 'clasp' for it. It works perfect.

"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."

Read more here: https://developers.google.com/apps-script/guides/clasp