Generate invoice ledger
generate_invoice_ledgerUse this when the user wants several invoices in one spreadsheet ("put these invoices into Excel", "invoice log from these PDFs", "purchase ledger", "VAT summary by rate", "check these invoices for duplicates"). Send the invoices as rows when their values are in the chat or a screenshot; send attached invoice PDFs (selectable text) in files; send pasted invoice text in invoice_texts (one string per invoice), and use text only as a fallback. Returns an Excel ledger (supplier, invoice number, invoice and due date, currency, net, tax per rate, tax total, gross, status) with By supplier, By tax rate and Checks sheets, and a CSV. Flags totals that do not equal net + tax, tax that does not match its rate, and duplicate invoice numbers per supplier. Reads header totals only, not line items. Does not read scanned images, convert currencies, file tax returns, or say whether tax is reclaimable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Fallback only: several invoices pasted as one text; they are split at --- lines or where a new invoice number starts. | |
| files | No | Invoice PDFs with selectable text (not scans), up to 20, e.g. acme-inv-1001.pdf, northwind-re-77.pdf. A .txt with pasted invoice text also works. | |
| currency | No | Currency for invoices that show none, as an ISO code, e.g. USD. A code printed on the invoice wins. | |
| invoices | No | Invoices as rows, one per invoice, e.g. [{"supplier":"Acme Supplies Ltd","invoice_number":"INV-1001","invoice_date":"2026-10-01","currency":"GBP","net":1250,"tax_rate":20,"gross":1500}]. Use this when the invoice values are in the chat or a screenshot. | |
| date_order | No | Order of numeric dates such as 03/04/2026: DMY (UK, EU) or MDY (US). Detected when a day is above 12. | |
| decimal_mark | No | Decimal mark of the amounts: "." (1,234.56) or "," (1.234,56). Detected per invoice when omitted. | |
| invoice_texts | No | Pasted invoice text, one string per invoice, e.g. ["Acme Supplies Ltd\nInvoice No: INV-2044\nInvoice Date: 14/10/2026\nSubtotal £2,400.00\nVAT 20% £480.00\nTotal £2,880.00"]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | ||
| issues | Yes | ||
| preview | Yes | ||
| invoices | Yes | ||
| downloads | Yes | ||
| currencies | Yes | ||
| by_supplier | Yes | ||
| by_tax_rate | Yes | ||
| preview_count | No | ||
| skipped_files | Yes | ||
| by_supplier_count | No | ||
| by_tax_rate_count | No | ||
| duplicate_numbers | Yes | ||
| invoices_with_issues | Yes | ||
| links_expire_minutes | Yes | ||
| arithmetic_mismatches | Yes |