ASS02: Setting Up Your Apps Script Development Environment

Introduction

The complexities of Apps Script can be daunting for beginners. This tutorial will guide you through the process of setting up your Apps Script environment, providing a clear and concise foundation for your future coding endeavors.

YouTube

Join Memberships

Presentation

Online Environment

If you are new to coding, the Apps Script online editor is a great place to start. It is a lightweight and convenient option for small projects that allows you to access your code from anywhere with an internet connection.

Script projects are either standalone or container-bound. Unlike standalone projects, container-bound projects can be connected to Google Sheets, Docs, Slides, and Forms.  Standalone script projects are necessary in certain situations, such as when building an add-on to publish on Google Workspace Marketplace.

You have 3 options to create a new Apps Script project:

  • Create a standalone project by visiting https://script.google.com/home.
  • Create a standalone project by using Google Apps Script app in Google Drive.
  • Access the Script Editor through Google Sheets, Docs, Slides, or Forms to start a container-bound project.

* If you don’t have this option on your Google Drive, try to install it via “connect more apps”.

Local Environment

A local development environment is better suited for managing numerous files and constructing a large project.

  1. The first step is to ensure that nodejs and npm are installed on your local machine. If you haven't done this yet, please visit the provided link to complete the installation.

https://nodejs.org

  1. Ensure the success of the installation by running these commands in your terminal after installing.

node –version # verify the installation of node

npm –version # verify the installation of npm

  1. We’ll need to install @google/clasp to develop our projects locally, CLASP stands for Command Line Apps Script Project. Here is the list of commands of CLASP, you can keep it as a reference since not all of them are used in this tutorial.

npm install -g @google/clasp

  1. To enable the CLASP command to function, adjust your settings to activate the Google Apps Script API.

https://script.google.com/home/usersettings

  1. Login with CLASP by running the command below.

clasp login

clasp logout

  1. Create a new project with CLASP, or clone an online project to local.

clasp create –title “ASS02” –type sheets # create a new container-bound project with title ASS02 for a Google Sheets

clasp create –title “ASS02” –type standalone # create a standalone project (type is optional)

clasp clone “script id of the project to be cloned” # clone an online project

And a hidden file .clasp.json will be created by CLASP once the new project is created or cloned. There is no parentId when the project is standalone.

        

{

  "scriptId": "xxx",

  "rootDir": "./",

  "parentId": ["xxx"]

}

  1. Push local code to online projects once we have the .clasp.json file in the project.

clasp push

  1. Pull online projects to local once we have the .clasp.json file in the project.

clasp pull

  1. Open the project.

clasp open

  1. We may need to install the type @types/google-apps-script package for autocompletion.

npm init -y # initialize the project

npm install --save @types/google-apps-script # install the types for google apps script

Apps Script Simplified

Links

Join Memberships Make a copy Github Hire Me Buy Me a Coffee

Previous Read

ASS01: Overview of Google Apps Script

Next Read

ASS03: Introduction to the Google Sheets API

Comments

  1. Setting up the right development environment is an important first step when learning Google Apps Script. The online editor provides a convenient starting point for beginners, while CLASP enables developers to manage scripts locally, organize project files, and synchronize code with Google Apps Script. Understanding the differences between standalone and container-bound projects helps developers choose the right setup for their automation requirements.

    For developers working with Google Workspace automation, Node.js provides a useful foundation for local tooling and JavaScript development. Nodejs Course is relevant for building familiarity with the Node.js ecosystem, npm packages, and command-line tools used in modern development workflows.

    ReplyDelete
  2. Organizations can also benefit from structured JavaScript training when developing internal automation solutions and maintaining shared codebases. Corporate Javascript Training can help teams strengthen their JavaScript skills and apply them to practical projects involving Google Workspace, APIs, and development tooling.

    ReplyDelete

Post a Comment