por Emanuel Balsa

← Todas as skills

AILC-27 · Gaveta: Finanças & contabilidade

/statement-to-sheet

Transforma um extrato ou uma lista de faturas numa folha de cálculo que se prova a si própria: contagem de linhas, saldos e totais, com cada linha ilegível assinalada.

Pede-lhe: “Passa este extrato bancário em PDF para Excel e garante que não falta nenhuma linha.”

statement-to-sheet.zip · 128 linhas de texto simples

Quando corre

Turn a bank statement, card statement, invoice list or scanned report into a spreadsheet without losing rows or flipping signs. Counts the lines in the source first, extracts to a table, then proves the copy with control totals (row count, opening balance plus movements equals closing balance, sum of debits and credits) and lists every line it could not read. Use this skill whenever the user says "convert this statement to Excel", "put this PDF into a spreadsheet", "extract the transactions", "import this into my books", "categorise my expenses from this file", or uploads a statement, receipt batch or invoice list and wants rows and columns. ALSO use it proactively before any expense categorisation or VAT work that starts from a PDF or image. Do NOT use for files that are already clean spreadsheets (use number-check), for passwords, card numbers or anything the user has not first anonymised, or for tax filing decisions.

O ficheiro completo

statement-to-sheet/SKILL.md
---
name: statement-to-sheet
description: >-
  Turn a bank statement, card statement, invoice list or scanned report into
  a spreadsheet without losing rows or flipping signs. Counts the lines in
  the source first, extracts to a table, then proves the copy with control
  totals (row count, opening balance plus movements equals closing balance,
  sum of debits and credits) and lists every line it could not read. Use
  this skill whenever the user says "convert this statement to Excel",
  "put this PDF into a spreadsheet", "extract the transactions", "import
  this into my books", "categorise my expenses from this file", or uploads
  a statement, receipt batch or invoice list and wants rows and columns.
  ALSO use it proactively before any expense categorisation or VAT work
  that starts from a PDF or image. Do NOT use for files that are already
  clean spreadsheets (use number-check), for passwords, card numbers or
  anything the user has not first anonymised, or for tax filing decisions.
---

# Statement to sheet

Models are fast at reading a statement and sloppy at counting it. When they
turn a PDF into rows, the typical damage is quiet: a row dropped at a page
break, two digits swapped, a minus sign lost so a refund becomes a
purchase, a date read as month-first instead of day-first. The table looks
tidy and is wrong. Everything built on top of it (categories, VAT,
budgets, tax) inherits the error, and nobody can see where it started.

This skill makes the copy prove itself. Nothing is called "done" until the
extracted table reconciles to the totals printed on the source.

## Workflow

### 1. Protect first

If the file contains account numbers, names or card numbers, run the
redact-first skill before extracting, or tell the user to. Work on the
safe copy.

### 2. Fix the controls from the source

Before extracting anything, read these from the document itself and write
them down:
- Opening balance and closing balance, with the dates.
- Total debits and total credits, if printed.
- The number of transactions, if printed, or the page count and an
  estimate of rows per page.
- Currency, and the date format (day first or month first).

If the statement prints no totals, say so. The checks below are then
weaker and the output must say it.

### 3. Extract to a table

Columns: Date, Description, Amount, Direction (debit or credit), Balance
(if shown), Source page. Keep the description text as written. Amounts as
signed numbers: money out negative, money in positive. Never merge or
split lines to make them look neater.

### 4. Prove the copy

Run all of these and show the arithmetic:

1. **Row count:** rows extracted against rows expected, page by page.
2. **Balance walk:** opening balance plus the sum of all amounts equals the
   closing balance.
3. **Totals:** sum of debits and sum of credits against the printed totals.
4. **Running balance:** if the statement shows a balance after each line,
   check every line steps correctly. The first line that breaks is where
   a row was lost or altered.
5. **Sign and date scan:** list every refund, reversal and fee. Check
   that dates fall inside the statement period.

### 5. Report what failed

Every line that could not be read cleanly goes in an exceptions list:
blurred digits, cut-off text, handwriting, amounts that appear twice.
Never guess a digit. Mark it UNREADABLE with its page and position.

### 6. Output

```
## Statement to sheet: [source], [period], [currency]

| Control | Source says | Table gives | Result |
|---|---|---|---|
| Rows | 47 | 47 | OK |
| Opening + movements | 1,204.10 closing | 1,204.10 | OK |
| Total debits | 3,310.25 | 3,310.25 | OK |

**Exceptions:** [none, or list with page and position]
**Status:** RECONCILED / DOES NOT RECONCILE, gap of [amount]

[the table]
```

If the status is DOES NOT RECONCILE, state the gap in money and use the
running balance to say between which two lines it opens.

## Judgment rules

**A table that does not reconcile is not a result.** Say so at the top and
do not categorise, total or analyse it until the gap is explained.

**Never fill a gap with a plausible row.** A missing line is reported as
missing, with the amount it must be for the totals to work, labelled as an
inference.

**Ask about dates once.** If a date like 03/04 is ambiguous, check it
against the statement period and state the format you assumed.

**Keep extraction and interpretation apart.** This skill copies. Whether an
expense is deductible or a payment is a duplicate is a later step, with the
user in charge.

**Say what you could not see.** Low-quality scans, rotated pages and
password-protected files are reported, not worked around.

## Example

A freelancer uploads a three-page card statement. Page 2 ends mid-table.
The printed summary shows an opening balance of 800.00, a closing balance
of 1,150.00, 31 transactions, debits of 940.00 and credits of 1,290.00.
The first extraction gives 30 rows. The balance walk is off by 62.50, and
the running balance breaks between a pharmacy line and a train ticket at
the page break. The skill reports the gap, points to the page break, asks
the user to read the missing line from page 2, adds it, and then shows all
controls passing. (The figures are illustrative.)

AILC-28 /chatbot-pick-check →

Um email abre a biblioteca inteira.

Todas as skills, as de hoje e as novas de cada semana. Enviamos emails ocasionais sobre AI no trabalho com dinheiro. Cancelas num clique.