📬Most Popular

Inbox Triage System

Stop manually sorting clinic emails. This script auto-classifies incoming emails into categories (referrals, prescriptions, bookings, lab results, billing, patient questions), applies Gmail labels, and drafts reply templates.

Google Apps ScriptEasySaves 3–5 hrs/week

The problem

The average clinic inbox receives 50–150 emails per day. Staff spend 1–2 hours just sorting and routing messages. Urgent referrals get buried under billing inquiries. Patients wait longer for responses.

How it works

  1. 1Runs automatically every 5 minutes via a timed trigger
  2. 2Scans unread emails and classifies by keyword matching
  3. 3Applies Gmail labels (Clinic/Referrals, Clinic/Bookings, etc.)
  4. 4Drafts reply templates for common categories
  5. 5Sends an optional daily digest to the clinic manager

What you need

  • A Google Workspace account (Gmail)
  • Access to Google Apps Script (Extensions menu in Google Sheets)
  • 5 minutes for setup

Download

Setup guide

1

Create a new Google Sheet

Open Google Sheets and create a blank spreadsheet. Name it 'Clinic Inbox Triage'. This sheet will be the host for the script (you don't need to put any data in it).

2

Open Apps Script

Go to Extensions → Apps Script. This opens the script editor. Delete any existing code in the editor.

3

Paste the script

Copy the full script below and paste it into the Apps Script editor. Then click the floppy disk icon (or Ctrl+S) to save.

4

Customise your categories

Edit the CATEGORIES object near the top of the script. Add or remove keywords for each category to match your clinic’s email patterns. For example, add your specialist names to the referral keywords.

Tip: Start with the defaults and refine after a week of use. Check the Gmail labels to see how emails are being classified.
5

Set your notification email (optional)

Find the CONFIG object at the top and set NOTIFY_EMAIL to your clinic manager’s email address. Leave it blank to skip the daily digest.

6

Run the setup

In the Apps Script editor, select 'setupInboxTriage' from the function dropdown (top bar), then click Run. You’ll be asked to authorise the script — click through the permissions. This creates all Gmail labels and sets up the automatic trigger.

Google will show a 'This app isn’t verified' warning. Click 'Advanced' → 'Go to Clinic Inbox Triage (unsafe)'. This is normal for personal scripts.
7

Verify it’s working

Wait 5 minutes, then check your Gmail sidebar. You should see new labels under 'Clinic/'. Send yourself a test email with the word 'referral' in the subject to confirm it gets labelled.

Full code

inbox-triage.gs
/**
 * TOSC Inbox Triage System
 * Auto-labels, routes, and drafts replies for clinic emails.
 *
 * SETUP:
 * 1. Open Google Sheets → Extensions → Apps Script
 * 2. Paste this code and save
 * 3. Run setupInboxTriage() once to create labels and triggers
 * 4. Customise CATEGORIES below for your clinic
 */

// ── Configuration ──────────────────────────────────────────────
const CONFIG = {
  CHECK_INTERVAL_MINUTES: 5,
  PROCESSED_LABEL: "Triaged",
  NOTIFY_EMAIL: "", // set to clinic manager email for daily digest
};

const CATEGORIES = {
  referral: {
    keywords: ["referral", "refer to", "sp

// ... Enter your email above to see the full code

Need help setting this up?

Book a free 30-minute call. We'll walk through the setup together and customise it for your clinic.

Book a Setup Call