
Photo by Jorge Jesus from Pexels
Google Apps Script makes it is easy for you to integrate data and functionality from Gmail, Google Drive, Google Maps, YouTube, and most other Google APIs. Apps Script is JavaScript under the hood so you don’t have to learn a new language and you don’t have to manage any servers since all your code runs on the Google Cloud, not your browser.
In this video tutorial, you’ll learn how to develop Google Apps Script projects locally on your computer inside Visual Studio Code. You can write your code in modern JavaScript, neatly organized in modules, and the build environment will use Babel and Webpack to transform your code into a version of JavaScript that is compatible with Apps Script.
Modern Development with Google Apps Script
There are quite a few advantages with having a local development environment vis-a-vis writing code in the Apps Script Cloud IDE.
- You can write code with ES6 Classes, Arrow Functions, Modules, Destructing and use all the other modern JavaScript features.
- The development experience inside VS Code is unmatched and tools like ESLint and Prettier make it easier for you to catch errors early in the development.
- The build and deployment process can be completely automated with npm scripts and CLASP, Google’s command line utility for Apps Script.
- VS Code has built-in support for Git and integrates with source control providers like Github and Gitlab. It is therefore easier to track changes and restore previous versions of the code.
- You can quickly integrate JavaScript libraries like LoDash, Moment, Underscore and any of the NPM packages into your code.
- You can use modern frameworks like React, Vue.js and Angular to build the HTML frontend that connects to the backend with the Google Script Client API.
Getting Started with the Apps Script Starter
The Starter kit is a boilerplate for quickly getting started with local Apps Script development locally inside VS Code. Open your terminal and run the following commands:
1. Clone the Github repository to a local folder
git clone my-project2. Switch to the project folder
3. Install all the project dependencies and utilities
4. Connect CLASP to your Google account
5. Create a new Google Apps Script project in your Google Drive with CLASP
npx clasp create --title "My Project" --rootDir ./dist --type standaloneThis command will create a new .clasp.json file in your project folder that links the local folder with your Apps Script project. During build, Webpack will bundle all your code in a single JavaScript file and add it to the ./dist folder that Clasp will push to your Apps Script project.
Next, open the current project folder inside VS Code with the code . command. It includes some sample code but we will start with a blank folder so delete everything that’s inside the src folder.
Inside the src folder, create a new file – email.js – and write a simple arrow function that prints a list of all the email addresses connected to your Gmail account.



