Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)
AI Summary
--- title: "Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)" published: true description: "Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)" tags: n8n, automation, tutorial, javascript --- **Flow:** Schedule Trigger ...

title: "Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)" published: true description: "Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)" tags: n8n, automation, tutorial, javascript
Flow: Schedule Trigger (daily 9am, workflow timezone set) → Google Sheets "Get rows" → Code node (decide) → Send Email (SMTP) → Google Sheets "Update row" (match on row_number).
The decision logic
- Skip rows where status is
paid,cancelledoron hold. daysFromDue = today − due_date, where today is the date in the workflow timezone:$today.toFormat('yyyy-MM-dd'), notnew Date().toISOString(), which gives the UTC date (at 9am in Sydney that's still yesterday, so every count comes out a day short). AcceptYYYY-MM-DDandDD/MM/YYYYtext plus Google Sheets serial numbers, and reject impossible dates instead of lettingDate.UTCroll them over.- Stages = [−3, 0, 7, 14, 30]. Pick the highest stage whose offset ≤ daysFromDue, so downtime doesn't cause a burst of emails.
- Send only if that stage's index is greater than the stored
last_stage_sentindex (idempotent). - Write back
last_stage_sentandlast_sent_date.
Gotchas we hit
- Send Email v2.1 appends an n8n attribution footer by default. Turn it off under Options.
- Importing with
n8n import:workflowfails if the JSON has noid. - Test against a local SMTP catcher (e.g. Python aiosmtpd) before touching a real inbox.
- Google Sheets can hand you a date cell as a serial number (
46312is 17 Oct 2026), depending on the Get rows node's Options → Output Formatting → Date Formatting. A five-digit number matches neither text pattern, so a reformatted column quietly drops out of the reminders. We set that option to Serial Number explicitly and convert it (snippet below). - The email goes out before
last_stage_sentis written, so if Update row fails, the next run sends the same stage again. Turn on Retry On Fail for the Update row node and set an Error Workflow so you hear about it.
const todayStr = $today.toFormat('yyyy-MM-dd'); // workflow timezone, not UTC const today = new Date(todayStr + 'T00:00:00Z'); const EPOCH = Date.UTC(1899, 11, 30); // Google Sheets / Excel day zero const ymd = (y, m, d) => { const t = new Date(Date.UTC(y, m - 1, d)); return t.getUTCMonth() === m - 1 && t.getUTCDate() === d ? t : null; }; function parseDate(v) { const s = String(v ?? '').trim(); let m; if (typeof v === 'number' || /^\d{5}(\.\d+)?$/.test(s)) { const n = Number(s); // Sheets serial return n > 20000 && n < 80000 ? new Date(EPOCH + Math.floor(n) * 86400000) : null; } if ((m = s.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/))) return ymd(+m[1], +m[2], +m[3]); if ((m = s.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/))) return ymd(+m[3], +m[2], +m[1]); // DD/MM/YYYY return null; } const daysFromDue = due => Math.round((today - due) / 86400000);
AU GST wording
If the business is GST-registered: "Tax invoice … Total includes GST of $X", where X = total ÷ 11 rounded to the cent. Otherwise: "Invoice … No GST has been charged".
Updated 17 Oct 2026: added the timezone, serial-date and write-back notes after a reader's comment. Thank you.
Packaged version with guide, sample sheet and 5 templates: https://ledgerlinetools.gumroad.com/l/au-invoice-chaser
Published by Ledgerline Tools, a small Australian automation studio. Questions: ledgerlinetools@proton.me