Listens for new emails with spreadsheet attachment
The original workbook contains invalid XML characters (such as ? in sheet titles) that break standard spreadsheet libraries. The n8n extraction node reads raw binary buffers directly without failing on workbook metadata corruption.
Rather than repairing broken formulas across 5 overlapping tables, Code in JavaScript4 scans rows and extracts 3 dedicated slices: Fuel (Rows 6–16), Cookies (Rows 9–18), and Expenses (Rows 38–48). Non-transactional noise (Panic Scores, Toaster outputs) is rejected.
Each category executes domain-specific cleaning rules: date standardizer parses Tue? 17 to 2026-06-17, negative costs (-2.49) are rectified using known fuel tank capacities, snack names are cleansed, and UK VAT rules (20% for fuel/ops, 0% for confectionery) are applied.
The 3 streams converge into an append Merge node. Code in JavaScript3 purges flagged duplicate entries (such as Row 15's "duplicate maybe"), sorts all items chronologically, and maps every record into a consistent 11-column tabular structure.
Writes the 29 verified transactions into the Google Sheet master ledger. Reconciles exact spend to £2,785.48 and recovered VAT to £471.36.
| ID | Date | Category | Description | Qty / Vol | Amount (£) | VAT (£) | Paid By | Payment | Receipt | Notes |
|---|