Google Apps Script in VSCodium: The Professional CLASP Workflow
If you have ever felt limited by the Google Apps Script browser editor, you are ready for a local workflow. This guide is an invitation to treat GAS as a professional development platform.
By using CLASP (Command Line Apps Script Projects), we treat Google projects like modern software: version-controlled, modular, and built with the full power of VSCodium.
1. The Setup: Local-First Development
We avoid global installs to keep our system 'countertop' clean. By installing CLASP and TypeScript definitions locally, your VSCodium gains full Intellisense for the SpreadsheetApp and other Google services.
# Step 1: Initialize project
npm init -y
# Step 2: Install tools locally
npm install --save @google/clasp
npm install --save-dev @types/google-apps-script concurrently gulp2. The Pipeline: Why We Use Gulp
Google Apps Script expects .gs files. Our local environment uses standard .js. Our Gulp pipeline acts as a 'Distiller' that prepares our code for the cloud by mapping extensions and stripping out development logic.
// Renaming logic within Gulpfile.js
.pipe(rename(function (path) {
if (path.extname === '.js') {
path.extname = '.gs';
}
}))3. The 'Command Center': package.json
A full package.json does more than list dependencies; it defines your entire workflow. Below is a complete example showing how we use concurrently to build and push in a single stroke.
{
"name": "gas-pro-workflow",
"description": "Professional GAS environment",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "gulp watcher",
"gprep": "gulp buildProd --gprep",
"clasppush": "npx clasp push -f",
"gpush": "concurrently \"npm run gprep\" \"npm run clasppush\"",
"gpull": "npx clasp pull",
"clean": "gulp clean"
},
"dependencies": {
"@google/clasp": "^2.4.2"
},
"devDependencies": {
"@types/google-apps-script": "^1.0.76",
"concurrently": "^8.2.2",
"gulp": "^4.0.2",
"gulp-rename": "^2.0.0",
"gulp-strip-code": "^0.1.4",
"yargs": "^15.4.1"
}
}💡 Pro-Tip: Using Dev-Only Blocks
Use these comments to surround code that you only want to run on your local machine. Gulp will strip these out before the push, keeping your production script lean.
/* start-dev-block */
console.log('Running in local dev mode...');
const devConfig = { apiKey: 'LOCAL_KEY' };
/* end-dev-block */
function onOpen() {
const menu = SpreadsheetApp.getUi().createMenu('Inventory');
}| Stage | File State | Location |
|---|---|---|
| Coding | Standard .js + Dev Blocks | /src/js |
| Pre-processing | Stripped .gs (No Dev Blocks) | /appsscript |
| Deployment | Cloud-ready Script | Google Cloud Console |
An Invitation to Explore
Google Apps Script is the 'glue' of the Google Workspace. You are no longer just writing 'scripts'; you are architecting cloud applications. With local Git history and a robust Gulp pipeline, you can build with confidence.
Welcome to the world of professional GAS development.