Author: By Raj
Part of our Google Apps Script Consulting guides. Need this built for your team? Hire a Google Apps Script developer.
Estimated reading time: 10 minutes
Using clasp to Develop Apps Script Locally (VS Code + Git Workflow)
clasp (Command Line Apps Script Projects) bridges your local repo and Google's online script editor. Teams gain Git history, ESLint, Prettier, and CI checks while still deploying to Workspace.
A typical workflow: clasp login, clasp clone <scriptId>, edit .gs/.html files locally, clasp push, then clasp deploy for versioned web apps. Use .claspignore to skip node_modules.
This guide covers authentication, push/pull conflicts, and npm scripts that wrap clasp for repeatable releases. Pair with /blog/google-apps-script-best-practices for secrets hygiene in repos.
Install clasp and authorize
Install globally with npm install -g @google/clasp, then clasp login --no-localhost if your environment blocks the OAuth loopback. Save credentials outside the repo.
Enable the Apps Script API in Google Cloud Console for the Google account you use, clasp cannot push without it.
Clone and project layout
Run clasp clone SCRIPT_ID to download appsscript.json and source files. Container-bound scripts expose their ID under Project Settings > Script ID.
Keep appsscript.json timeZone and exceptionLogging aligned with production. Commit src/**/*.gs but not .clasprc.json.
Push, pull, and merge conflicts
clasp push uploads local files; clasp pull overwrites local when someone edited online. Establish team rule: edit in Git OR online, not both without pulling first.
Use clasp push --watch during active development to mirror saves, but disable watch in CI.
Deployments and versions
clasp deploy creates immutable versions for web apps, critical when doGet must not change mid-day for users bookmarking URLs.
Script npm run deploy can chain clasp push && clasp deploy -d "v1.2.3" for auditable releases.
Example code
// package.json script example // "push": "clasp push", // "open": "clasp open", // "deploy": "clasp push && clasp deploy -d "production""
| Approach | Best for | Tradeoff |
|---|---|---|
| Apps Script native | Google Workspace-centric workflows | 6-min limit, quotas |
| Zapier / Make | No-code, many connectors | Per-task cost, vendor lock-in |
| Python + Cloud | Heavy data / ML | Hosting cost, separate auth |
| Google Apps Script consulting | Production custom logic | Build cost, you own code |
FAQ
Can clasp manage container-bound scripts?
Yes. Use the script ID from the bound project. You still edit the parent spreadsheet separately; clasp only syncs the script files.
Why does clasp push fail with insufficient permissions?
Enable the Apps Script API for your Google account and ensure you are logged in as a user with edit access to the script project.
Should I store clasp credentials in CI?
Use a service account or clasp login with a dedicated automation user and store the token in CI secrets, never commit .clasprc.json to GitHub.
How do I run functions locally?
clasp run FUNCTION_NAME executes in Google's cloud, not on your laptop. Local unit tests mock SpreadsheetApp via libraries or extract pure functions.
Does clasp support TypeScript?
This project uses JavaScript per team standards, but clasp can compile TypeScript if you add a build step. Push compiled .gs output, not TS sources, unless using bundlers.
Need this done for you? I handle this as part of my consulting work, fixed-price quote within 24 hours.
Book a call with Raj →Get the full Using clasp to Develop Apps Script Locally (VS Code + Git Workflow) script template
I'll email you a production-ready, commented version you can deploy in 10 minutes.
Continue reading
Apps Script Core
How to Automate Google Sheets with Apps Script (Beginner Guide)
Apps Script Core
Master Google Apps Script: A Step-by-Step Roadmap for Non-Coders
Apps Script Core
Google Apps Script Trigger Not Working? Here's the Fix
From another topic
Google Sheets CRM Automation: Triggers, Pipelines, and Follow-Ups →Need help with this? I handle this as part of my Google Apps Script Consulting service.
Workflow automation, script audits, triggers, quotas, and production best practices.
See how it works →