Motivation
Every Google Apps Script project on Github visualized describes how to use https://scrviz.web.app to find and visualize public Apps Script projects on Github.
More and more apps script projects are being publicly shared on github. Here are some interesting stats from just 1 month’s tracking.
I thought it might be useful if you are learning Apps Script to be able to pull in examples to play around with. This latest release adds the ability to configure and clone projects from github directly into the Apps Script IDE.
Getting started
Let’s say you want to find a project that uses, say, the BigQuery advanced services with Sheets, and clone it to see how it works in Apps Script. First find which projects are using that advanced service
We’ll take a look at this one by google, which uses both bigquery and sheets
Clicking on the manifest file will bring up this information sheet, and a quick scan of the contents of the manifest looks promising
Authorization
To be able to create an Apps Script project, Scrviz needs
- Write Access to your apps script projects
- Apps Script API access to be enabled for you
Both of these are just one off procedures. The first is by a regular Google login dialog that will ask you for the necessary scopes. For the second you have to ensure that the Apps Script API setting at https://script.google.com/home/usersettings is on.
Additionally you need to give Read access to github. This will just ask for access to public repos, and it is only necessary to overcome github rate limiting that it applies to anonymous accounts. Once complete, the configure button will light up.
Selecting the files to clone
This will access the github repository selected and bring up the files and subdirectories of the repository tree, starting at the location of the manifest file you’ve selected. Some repositories will have multiple projects in them, and scrviz will always start at the location of appsscript.json file it refers to, rather that the top of the repo itself which avoids trying to add multiple appsscript.json files to the same Apps Script project.
The first section is for you to comfirm that what you intend to do with this code is within the usage restrictions of the owner of the repo, which you can do by visiting the repo and reading any licenses there. Assuming this is good, then you can go ahead and select the files you want to clone. By default, all apps script supported files are checked, and others are not. If you select for example README.md, then it will be renamed as an html file when cloned to Apps Script. All subfolders are included in the selection too, and their contents follow the same rules.
Some projects have been created using clasp, and you’ll see a .clasp.json file in the list if they have been. These type of projects can be cloned directly into the IDE here as well, but note that .ts (typescript) files are not supported directly by Apps Script and you will probably need to use clasp for thes kind of projects.
Container bound or standalone
Scrviz can create both container bound and standalone scripts. If you need to create a container bound script, i.e. one contained within a Sheet, Slides, Document ot form, you can use the picker dialog to choose which one.
Which will bring up this dialog
Creating the project
The create button will kick off the creation process
and finally, a link to go straight there to the IDE
Here it is in the IDE
Links
Github https://github.com/brucemcpherson/gitvizzy
All about scrviz