Automation

Payment reminder emails from a Google Sheet

Apps Script tool that flags overdue invoices in a Sheet, drafts reminder emails, and sends them daily with a dry-run safety mode.

google-sheetsapps-scriptjavascriptnodejsclasp

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add payment-reminder-emails-from-a-google-sheet-26eb32
CLAUDE.md
# Payment reminders

## Purpose

This project is a Google Sheets tool built with Apps Script. A Sheet lists clients, invoice amounts, due dates and paid status. A daily script emails reminders to clients whose invoices are unpaid and past due. The tool also flags overdue clients, drafts reminder emails, and logs every send attempt.

## Layout

- `src/Code.gs`: all Apps Script logic (menu, sheet reading, overdue rules, email text, trigger, guarded sending)
- `src/appsscript.json`: manifest (time zone, OAuth scopes, runtime V8)
- `tests/`: Node tests for pure functions (`tests/logic.test.js`)
- `SPEC.md`: what the tool must do
- `PLAN.md`: phased build plan, each phase ends with a `/goal`
- `REVIEW.md`: review checklist

@REVIEW.md

## Commands

- `npm test`: runs the Node tests on pure logic. No network, no Gmail.
- `npx clasp open`: opens the Apps Script editor in the browser.
- `npx clasp push`: uploads `src/` to Apps Script. Ask me first.
- `npx clasp deploy` and `npx clasp run`: ask me first. Never run them to test sending.

## Gotchas

- Apps Script has no npm. Keep pure logic (date math, row parsing, email text) in functions that take plain objects. Tests load them through the guarded `module.exports` block, which is skipped inside Apps Script (`typeof module` check).
- Never send email from a test or a preview. `sendReminders` must honour the DRY_RUN flag from `Settings!B2` (Send live emails). Default is ON: blank or FALSE means dry run.
- Gmail quota applies (about 100 recipients per day on consumer accounts). Keep `MAX_SENDS_PER_RUN = 50` and the per-invoice cap of 3 reminders.
- Log every send attempt to the Sent Log tab, including errors.
- Write to sheets in one batch call where possible. Do not call `getRange` in a loop per cell.
- Column names come from SPEC.md exactly (Client Name, Email, Invoice ID, Amount, Due Date, Paid, Last Reminder Sent, Reminder Count). If a column must change, update SPEC.md first, then the code.
- `.clasp.json` holds a real script ID. Do not commit it if the repo is shared. In docs and examples, use `YOUR_SCRIPT_ID`.
- Never put real email addresses, script IDs or API keys in code, tests or docs. Use placeholders such as `you@example.com`.
- Dates use the script's time zone (set in `src/appsscript.json`). Compare due dates at start of day.

## Non-default conventions

- Plain English in menus and messages. No jargon in anything the user sees.
- The Sheet and the code stay in sync through the column names above. Do not rename a column in only one place.
- Functions named in SPEC.md wiring are the only ones that read or write sheets. Pure functions never touch `SpreadsheetApp`.

## Workflow

1. Explore the code and SPEC.md first.
2. Plan the phase in PLAN.md.
3. Implement one phase only.
4. Run the `verify` skill and read failures only.
5. Run `/clear` before starting the next phase.

Use `/code-review` before accepting a phase. It applies the rules in REVIEW.md.
Use for my project