CLASP - Google Apps Script tutorial

Search for a command to run...

No comments yet. Be the first to comment.
We’ve tried out lots of apps over time, and honestly—not all of them do what we really need. That’s why I’m writing this blog post: to share some of the challenges we’ve noticed with the Shopify Forms app and hear what others think too. If you’ve fou...
Hey everyone, Dorothi Viki here. For the last decade, I’ve been in the digital marketing trenches. I’ve managed budgets big and small, and I’ve seen firsthand how crucial it is to know what people are saying about you online. When you’re starting out...
If you’re a small business owner, freelancer, or consultant, your website is your storefront. But traditional website development can be expensive, slow, and intimidating. Platforms like SpreadSimple remove these barriers by allowing you to turn Goog...

For SEO professionals, content marketers, freelancers, and consultants, keyword research is non-negotiable. It’s the foundation of any effective search strategy. However, with so many tools behind paywalls, finding a reliable, high-quality, free Goog...
With the rise of AI agents and Claude-specific development environments, understanding Claude Code has become essential for modern developers, freelancers, and consultants. Whether you're building Multi-Component Programs (MCPs) or designing autonomo...
CLASP is a command-line application developer by Google to develop and manage the Google Apps Script project easily. You can always use the built-in Script Editor to write App Scripts, however, it becomes difficult to manage the project when it becomes larger. For example, if you have multiple server-side functions or HTML files, it's always better to use CLASP to develop, debug & test the App Script projects. I used clasp for my previous project and clasp helped me heavily to debug and test the project on my local machine.
Features:
Make sure you have installed the Nodejs environment.
I will recommend using VS Code for editing code.
Also, enable Google Apps Script API permission from here, https://script.google.com/home/usersettings

Now, run the below command. npm is a package manager which already installed if you have Nodejs already.
npm install -g @google/clasp
After that,
$ clasp
Great. If you have any issue like command not found, check npm prefix path. I used npx clasp to run before when I had some issues with the project. npx execute the package from the local or remote package.
$ clasp login
Now, log in using your Google account.
If you need to create a separate project, use the below command to create the standalone script.
clasp create
In this tutorial, I am showing clasp clone from Google Sheet. You need the Script ID to get the script from Google Sheet.
Open your Google Sheet, open Tools > Script Editor, this will open the Apps Script page. Then, click on the settings from the sidebar and copy Script ID.

After getting the project script ID, now you need to create a local project. I would suggest cloning the remote project to a separate folder like the below code which will help you to separate src files and Nodejs files.
Note that, all the .gs files now be converted into js files.

Now, clone the project using the command:
clasp clone "SCRIPT ID" --rootDir src/
This will pull the script as well as create an appscript.json.
Pull the project from the remote using the Script ID.
#Pull from remote
clasp pull
#Pull from remote using version number
clasp pull --versionNumber 2
Push the project to the remote.
#Push to remote
clasp push
Go to https://github.com/google/clasp/blob/master/docs/typescript.md which talks about how to install Google Apps Script specific types on VS Code.
npm i -S @types/google-apps-script
I hope this tutorial helped you to set up a clasp-based project. It is always much efficient to use clasp based on the project rather than the inbuilt script editor.
Youtube Video - Step by step instructions
Gas-client ( https://github.com/enuchi/gas-client )
React-Google-Apps-Script