Skip to content

Boilerplate template for developing a Google Apps Script project that supports TypeScript.

Notifications You must be signed in to change notification settings

guywithacube/google-apps-script-typescript-boilerplate

Repository files navigation

google-apps-script-typescript-boilerplate

Boilerplate template for developing a Google Apps Script project that supports TypeScript.

This README is written for *NIX-like environments; however, it is likely applicable to other platforms.

Prerequisites

Install Node.js for your environment.

npm is distributed with Node.js. For further readings, see this npm page.

Install clasp by running:

npm install --global @google/clasp

Authenticate clasp with your Google Account by running:

clasp login

Getting started

  1. Clone this repository

  2. Install dependencies

    npm install
  3. Create a new Apps Script project

    clasp create --type standalone --title google-apps-script-typescript-boilerplate
  4. Compile all source files

    All TypeScript and JavaScript in src/ will be webpacked into dist/

    This repository comes with a helloWorld function by default

    npm run build
  5. Push to Apps Script

    Push all tracked files (see .claspignore) to Apps Script

    clasp push
  6. Verify the code was pushed in the Apps Script editor

    clasp open
  7. Run the helloWorld function

Using clasp run

clasp run [functionName] allows you to execute Apps Script functions remotely.

clasp run is initially rather troublesome to set up.

The Apps Script project must use a standard Google Cloud Platform Project. For more information, see the documentation on GCP Projects and Apps Script.

The standard GCP Project must also have an OAuth 2.0 client ID. For more information, see the GCP help article on Setting up OAuth 2.0.

Assuming both a standard GCP project and OAuth 2.0 client ID has been configured, this document can be followed to configure clasp run.

About

Boilerplate template for developing a Google Apps Script project that supports TypeScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published