A CODA file is the Belgian bank statement format defined by Febelfin (version 2.6, extensions .cod or .coda): fixed-width text that Excel cannot open in a useful way. To get it into Excel you can use the free converter in the browser with no sign-up (CODA to Excel online), or run the open-source package offline with pip install coda-to-excel, which writes a CSV that Excel opens directly. Both read the transactions, decode Belgian structured communications, and check that opening balance plus movements equals closing balance.
What is inside a CODA 2.6 file
Every line is a record of 128 characters, and the first characters say what kind of record it is. These are the records of the format; the package reads records 1, 21, 22, 23, 31 to 33 and 8, and skips the header 0 and the trailer 9:
| Record | Content |
|---|---|
0 | File header |
1 | Old balance: account, currency, opening balance |
21 | Movement, part 1: reference, signed amount, value date, communication, booking date |
22 | Movement, part 2: extra communication, customer reference |
23 | Movement, part 3: counterparty account and name |
31 / 32 / 33 | Extra information blocks for the movement |
8 | New balance (closing) |
9 | File trailer |
Amounts are stored as 15 digits with three decimals and a separate sign character (1 = debit), dates as DDMMYY. The package converts these into normal numbers and ISO dates. A structured communication of type 101 or 102 becomes the familiar +++123/4567/89012+++ form.
Convert it in Python
The package uses only the Python standard library. This is the demo CODA file used below (statement.cod, two movements, 128-character lines):
00 151126001 DEMO COMPANY BV 2 12001BE68539007547034 EUR0000000002500000011126DEMO COMPANY BV 2100010000REF2026001 0000000000840500041126 1101123456789012 041126 2300010000BE12345678901234 ATELIER ANTWERP NV 2100020000REF2026002 1000000000320250101126 0OFFICE RENT NOVEMBER BRUSSELS 101126 2300020000BE98765432109876 IMMO BRUSSELS SA 8001BE68539007547034 EUR0000000003020250151126 9 000006 The script:
import coda_to_excel as coda accounts = coda.parse_file("statement.cod") for acct in accounts: print(acct["account"], acct["currency"], "opening", acct["opening_balance"], "closing", acct["closing_balance"], "balance_ok:", acct["balance_ok"]) for tx in acct["transactions"]: print(tx["date"], tx["counterparty"], tx["amount"], tx["description"], tx["balance"]) print(coda.to_csv(accounts)) Real output:
BE68539007547034 EUR opening 2500.0 closing 3020.25 balance_ok: True 2026-11-04 ATELIER ANTWERP NV 840.5 +++123/4567/89012+++ 3340.5 2026-11-10 IMMO BRUSSELS SA -320.25 OFFICE RENT NOVEMBER BRUSSELS 3020.25 Date,Value Date,Account,Currency,Counterparty,Description,Reference,Amount,Balance 2026-11-04,2026-11-04,BE68539007547034,EUR,ATELIER ANTWERP NV,+++123/4567/89012+++,REF2026001,840.50,3340.50 2026-11-10,2026-11-10,BE68539007547034,EUR,IMMO BRUSSELS SA,OFFICE RENT NOVEMBER BRUSSELS,REF2026002,-320.25,3020.25 The CSV has the columns Date, Value Date, Account, Currency, Counterparty, Description, Reference, Amount and Balance, with amounts as plain signed numbers. Opening it in Excel gives one row per movement and a running balance. The package can also write a Xero CSV (to_xero_csv), a QuickBooks / Sage CSV (to_qbo_csv) and JSON (to_json).
One line on the command line
coda-to-excel statement.cod -o statement.csv This command finished with exit code 0 and wrote the same CSV as above to statement.csv. Use --format xero, --format qbo or --format json for the other outputs.
Common problems
- Opening the .cod file directly in Excel. It is fixed-width text with no delimiters, so everything lands in one column. The positions of the fields are defined by the CODA specification, which is why a parser is needed.
- Amount signs. The sign is a separate character in each record (
1means debit). The package makes debits negative, and the amounts in the sample output above show that: the rent is-320.25. - Balance check.
balance_okisTrueonly when opening balance plus all movements equals the closing balance exactly. It isNoneif the file has no closing record. If it isFalse, a movement is missing or a record was not understood. - Encoding and line breaks. The reader tries cp1252, then latin-1, then UTF-8, so Belgian accented names survive. If the whole file is one long line, the parser cuts it back into 128-character records.
- Several accounts in one file. The result is a list of accounts, each with its own transactions and its own
balance_ok.
Limits
The package targets the Febelfin CODA 2.6 layout described above; the README says it works with files from KBC, BNP Paribas Fortis, Belfius and ING Belgium and any bank following that specification, but I only tested it here with the small demo file shown. Currency detection looks for a fixed list of ISO codes (EUR, USD, GBP, CHF, CAD, AUD, PLN, SEK, DKK, NOK) and falls back to EUR. If the file contains no movement records, parse raises CODAError.
Package: coda-to-excel on PyPI (standard library only, no network calls).
Disclosure: I build the tool used in this post, and the article was written with AI assistance. If a code sample does not work for you, tell me in the comments and I will fix it.
