Google Workspace

Getting Started with Google Apps Script for Workspace Add-ons

A beginner-friendly guide to building and deploying Google Workspace add-ons using Apps Script.

By M Gulab Yar
September 5, 20247 min read
Share:
Getting Started with Google Apps Script for Workspace Add-ons

Introduction

Google Workspace add-ons extend Gmail, Docs, Sheets, Slides, and Calendar with custom functionality. The fastest way to build them is Apps Script — a cloud-hosted JavaScript platform that requires no servers of your own.

What is Apps Script?

Apps Script is a serverless runtime with built-in libraries for the entire Workspace suite. You write modern JavaScript, and Google handles hosting, authentication, and execution.

Apps Script projects run on Google’s infrastructure, so there is nothing to deploy or maintain for the runtime itself.

Setting Up Your Project

You can develop in the browser-based editor or locally with clasp, the command-line tool for Apps Script.

bash
npm install -g @google/clasp
clasp login
clasp create --type standalone --title "My Workspace Add-on"

Building a Card-Based UI

Workspace add-on interfaces are built from cards. The homepage trigger returns a card that Google renders inside the host application.

Code.gs
function onHomepage(e) {
  const section = CardService.newCardSection()
    .addWidget(
      CardService.newTextParagraph().setText('Welcome to your add-on!')
    );

  return CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle('My Add-on'))
    .addSection(section)
    .build();
}

Calling Workspace Services

Built-in services like SpreadsheetApp, DocumentApp, and GmailApp give you typed access to user content — subject to the scopes you declare in the manifest.

Request least privilege

Only declare the OAuth scopes your add-on truly needs. Over-broad scopes slow down verification and reduce user trust.

Publishing Your Add-on

  1. Configure the appsscript.json manifest with scopes and triggers.
  2. Test as an unverified app within your own account.
  3. Submit through the Google Workspace Marketplace SDK.
  4. Complete OAuth verification for public distribution.

Conclusion

Apps Script removes nearly all the infrastructure overhead of building Workspace add-ons. Start with a homepage card, wire in the services you need, and you can ship genuinely useful automation in an afternoon.

#Google Workspace#Apps Script#Add-ons#Automation#Tutorial

Related Articles