To develop and manage Apps Script projects from your terminal rather than the
Apps Script editor, you can use an open-source tool called
clasp codelab provides an overview of all
clasp lets you to develop your Apps Script projects locally. You can
write code on your own computer and upload it to Apps Script when you're
done. You can also download existing Apps Script projects so that you can edit
them when you're offline. Since the code is local, you can use your favorite
development tools like
git when building Apps Script
Manage deployment versions
Create, update, and view your multiple deployments of your project.
clasp allows you to organize your code into directories, which are preserved
when you upload them to script.google.com. For example:
# On script.google.com: ├── tests/slides.gs └── tests/sheets.gs # Locally: ├── tests/ │ ├─ slides.gs │ └─ sheets.gs
Once you've installed Node.js, you can use the following
npm command to
npm install @google/clasp -g
After installing, the
clasp command is available usable from any directory on
You can use
clasp to handle a variety of tasks from the command line. This
section describes common operations you can use when developing with
This command logs in and authorizes management of your Google account's Apps Script projects. Once it is run, you are asked to sign into a Google account where your Apps Script projects are stored.
This command logs out of the command line tool. You must re-login using
clasp login to re-authenticate with Google before continuing to use
Create a new Apps Script project
This command creates a new script in the current directory with an optional script title.
clasp create [scriptTitle]
This command also creates two files in the current directory:
.clasp.jsonfile storing the script ID.
appsscript.jsonproject manifest file containing project metadata.
Clone an existing project
This command clones an existing project in the current directory. The script must be created or shared with your Google account. You specify the script project to clone by providing its script ID.
To find the Script ID of the project, follow the below steps:
- Open Apps Script project.
- At the left, click Project Settings .
Under IDs, copy the Script ID.
clasp clone <scriptId>
Download a script project
This command downloads the Apps Script project from Google Drive to your computer's file system.
Upload a script project
This command uploads all of a script project's files from your computer to Google Drive.
List project versions
This command lists the number and description of each of a script project's versions.
Deploy a published project
To deploy a project with
clasp, first create an immutable version of the Apps
Script project. A version is a "snapshot" of a script project and is similar to
a read-only branched release.
clasp version [description]
This command displays the newly created version number. Using that number, you can deploy and undeploy instances of your project:
clasp deploy [version] [description]
clasp undeploy <deploymentId>
This command updates an existing deployment with a new version and description:
clasp redeploy <deploymentId> <version> <description>
This command lists the script project's deployment IDs, versions, and their descriptions.
Open the project in the Apps Script editor
This command opens a script project in the Apps Script editor. The editor is launched as a new tab in your default web browser.
Contribute to the
clasp open-source project
clasp on GitHub.