The online Apps Script editor is fine for quick scripts, but for anything serious you want a real editor, git version control, and a proper development workflow. clasp is Google's official CLI that lets you develop Apps Script locally and push changes to Google.
Install clasp
You need Node.js installed. Then:
Log in to your Google account
This opens a browser window to authorise clasp with your Google account.
Create a new project
This creates a .clasp.json file in your directory linking it to the Apps Script project.
Clone an existing project
Find the script ID in the Apps Script editor under Project Settings.
Push and pull code
Open the script in the browser
Watch for changes and auto-push
This keeps watching your local files and pushes every time you save — great during active development.
TypeScript support
clasp has built-in TypeScript support. Rename your files from .js to .ts and clasp will compile them before pushing.
Install the Apps Script type definitions for full autocomplete:
Now your editor knows about SpreadsheetApp, GmailApp, DriveApp, and all other services — with full type checking.
Project structure example
A typical clasp project looks like this:
.claspignore
Keep local files out of your Apps Script project:
Manage versions and deployments
Tips
- Add
.clasp.jsonto.gitignoreif you're sharing the repo — it contains your script ID. - Use
appsscript.jsonto pin OAuth scopes explicitly so you're not surprised by permission prompts. - clasp supports multiple environments by maintaining separate
.clasp.jsonfiles for dev and prod script IDs. - Run
clasp logsto stream Stackdriver logs from your deployed script directly in the terminal.