Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including google-apps-script with all npm packages installed. Try it out:

var googleAppsScript = require("google-apps-script")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

google-apps-script v3.0.0

gas, the complete CLI for Google Apps Script

gas logo

gas, for locally developing Google Apps Script projects

npm GitHub stars NPM Downloads Circle CI Known Vulnerabilities David Codacy Badge

Installation

$ npm i -g google-apps-script

Usage

Authenticate the Drive API

  • Add -f to force reauthentication
  • Add -s to show the authentication url instead of opening a webbrowser
$ gas auth [-f][-s]

Setup a new project or clone an existing one

$ gas new <projectName>
$ gas clone <projectName|projectId>

List your remote projects and their ids

  • There is an optional filter on projectName
$ gas list [filter]

Pull and push code from/to your remote project

  • Gas also supports shared scripts and Team Drives
  • Files in subfolders are mapped to their relative pathname in a project and the other way around
  • You can specify to pull or push a single file by adding a filename to the command
  • Delete a single remote file by adding -d to the push command
$ gas pull [fileName]
$ gas push [fileName] [-d]

Create, delete or rename a project in your Google Drive

  • Create will always happen in the root of My Drive (for now)
$ gas create <projectName>
$ gas delete <projectName|projectId>
$ gas rename <projectName|projectId> <newProjectName>

Linking a project to the current working directory

  • See the last example for some context
$ gas link <projectName|projectId>

Open the linked project or a specified project in the online editor

$ gas open [projectName|projectId]

Show some info about the linked project or a specified project

$ gas show [projectName|projectId]

Check for differences between your local files and Google Drive

$ gas status

Config (optional)

Configure gas to use .gs as local extension or to use a custom Google OAuth2 client to do the API requests

$ gas config [-e][-i][-r] [configFile.json]

Examples

$ gas new myScript
$ cd myScript
$ gas open
$ gas list
$ gas clone myScript
$ gas create myScript2
$ mkdir src
$ cd src
$ gas link myScript2
$ gas show
$ gas pull

.gitignore

Gas creates some extra files in a .gas folder. None should be checked into git, so a .gitignore file gets added to your project if there isn't one present yet.


That's all (so far).

Suggestions or questions?
Tweet me @MaartenDesnouck or create an issue on github.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free