MaartenDesnouck / google-apps-script

🛠 Manage and deploy your Google Apps Script projects using the command line
https://www.npmjs.com/package/google-apps-script
MIT License
118 stars 13 forks source link
apps-script cli gas-include google-apps-script google-drive npm
gas logo

gas, the Google Apps Script command-line tool

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

Installation

$ npm i -g google-apps-script

Getting started

Enable the Apps Script API for your account

Authenticate the Drive API

$ gas auth [-f][-s]

Local development

Setup a new script project or clone an existing one

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

List your remote standalone script projects and their ids

$ gas get projects [filter]

Pull and push code from/to your remote script project

$ gas pull [fileName]
$ gas push [fileName] [-d]

Rename a remote script

$ gas rename <projectName|projectId> <newProjectName>

Linking a script to the current working directory

$ gas link <projectName|projectId>

Open the linked or a specified project in the online editor

$ gas open [projectName|projectId]

Show some info about the linked or a specified project

$ gas show [projectName|projectId]

Check for differences between your local and remote project files

$ gas status

Including libraries

Managing projects, versions and deployments

Create, delete or get a remote project

$ gas create project <projectName>
$ gas delete project <projectName|projectId>
$ gas get projects [filter]

Create or get a version

$ gas create version [-d description] [-p projectName|projectId]
$ gas get versions [projectName|projectId]

Create or get a deployment

$ gas create deployment [-d description] [-v versionNumber] [-p projectName|projectId]
$ gas get deployments [projectName|projectId]

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 myProject
$ cd myProject
$ gas open
$ gas get projects
$ gas clone myProject
$ cd myProject
$ gas create myProject2
$ mkdir src
$ cd src
$ gas link myProject2
$ gas show
$ gas pull

.gitignore and .gasignore

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.

.gasignore has exacly the same purpose and functionality as .gitignore but for the Google Apps Script remote and gets created by default to ignore the node_modules folder.

$ cat .gasignore

That's all (so far).

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