Vyntrise Technologies logoVyntrise Technologies

Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)

October 16, 2026
By Ledgerline Tools
Original Source
Share:

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 ...

Build an invoice reminder workflow in n8n with Google Sheets (idempotent, AU GST wording)

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

  1. Skip rows where status is paid, cancelled or on hold.
  2. daysFromDue = today − due_date, where today is the date in the workflow timezone: $today.toFormat('yyyy-MM-dd'), not new Date().toISOString(), which gives the UTC date (at 9am in Sydney that's still yesterday, so every count comes out a day short). Accept YYYY-MM-DD and DD/MM/YYYY text plus Google Sheets serial numbers, and reject impossible dates instead of letting Date.UTC roll them over.
  3. Stages = [−3, 0, 7, 14, 30]. Pick the highest stage whose offset ≤ daysFromDue, so downtime doesn't cause a burst of emails.
  4. Send only if that stage's index is greater than the stored last_stage_sent index (idempotent).
  5. Write back last_stage_sent and last_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:workflow fails if the JSON has no id.
  • 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 (46312 is 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_sent is 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