Guides / CAMT.053 to CSV

CAMT.053 to CSV: which XML fields become which columns

CAMT.053 is the ISO 20022 bank statement in XML. To turn it into CSV, write one row for each <Ntry> (entry): its dates, its amount (negative when it is a debit), the currency, the status, the references and the remittance text. Milyo's free converter does exactly that in your browser: drop the file, download the CSV. Nothing is uploaded.

Published 2026-11-19. Everything about Milyo on this page is true of the code in the repository on that date.

The fields that matter

A statement holds one or more <Stmt> blocks. Each holds <Ntry> entries. This is what Milyo reads from each entry, and the column it becomes.

CSV columnXML elementNotes
entry_refNtryRefOften empty. Banks do not all fill it.
booking_dateBookgDt/DtOr BookgDt/DtTm: Milyo keeps the first 10 characters, the bank's own date, with no time-zone shift.
value_dateValDt/DtSame rule as above.
amountAmtSigned. A DBIT entry gets a minus sign. The XML amount is always positive.
currencyAmt/@CcyThree letters, such as EUR.
credit_debitCdtDbtIndCRDT (money in) or DBIT (money out).
statusSts (.02) or Sts/Cd (.08)BOOK is booked. See the next section.
bank_refAcctSvcrRefThe bank's own reference for the entry.
end_to_end_idNtryDtls/TxDtls/Refs/EndToEndIdThe id the payer's system sent. For a Stripe payout, this is where a payout id may appear.
remittanceRmtInf/UstrdFree text. If there are several Ustrd lines, they are joined with a space.
counterpartyRltdPties/Dbtr/Nm for a credit, Cdtr/Nm for a debitThe other party: the payer when money comes in, the payee when it goes out. In .08 the name is nested: Dbtr/Pty/Nm.
additional_infoAddtlNtryInfFree text from the bank.

One entry, one row

This entry is from the sample statement on the free matcher. The data is made up.

<Ntry>
  <NtryRef>2</NtryRef>
  <Amt Ccy="EUR">2400.00</Amt>
  <CdtDbtInd>CRDT</CdtDbtInd>
  <Sts>BOOK</Sts>
  <BookgDt><Dt>2026-11-02</Dt></BookgDt>
  <ValDt><Dt>2026-11-02</Dt></ValDt>
  <AcctSvcrRef>2026113000002</AcctSvcrRef>
  <NtryDtls><TxDtls>
    <RltdPties><Dbtr><Nm>KESTREL FOODS GMBH</Nm></Dbtr></RltdPties>
    <RmtInf><Ustrd>INV-2271</Ustrd></RmtInf>
  </TxDtls></NtryDtls>
</Ntry>

It becomes this row, in the column order of the table above:

2,2026-11-02,2026-11-02,2400.00,EUR,CRDT,BOOK,2026113000002,,INV-2271,KESTREL FOODS GMBH,

The same entry as a DBIT would have the amount -2400.00 and the payee's name in the counterparty column.

Booked and pending entries

Each entry has a status. BOOK means the bank has booked it: the money has moved. Other statuses, such as PDNG (pending) and INFO (information only), are not money that moved yet.

Milyo's free matcher keeps only BOOK entries by default. The mapping step says "Only rows where status is BOOK", and a link, "Include all rows", turns the filter off. After you apply the mapping it tells you how many entries the filter left out. A pending entry is not final, so matching it could give you a match against money that has not moved.

In a CSV you write yourself, keep the status column and filter on it. Do not drop it.

Which versions Milyo reads

CAMT.053 comes in versions, written as camt.053.001.02, camt.053.001.08 and so on. Milyo's tests read two layouts, and both pass:

Milyo ignores XML namespaces and looks for the element names above. A version in between, such as .04, should read if it uses the same element names, but we have not tested it, so we do not claim it. If Milyo cannot find a BkToCstmrStmt/Stmt element, it says so and stops.

What Milyo does not read

Read it in your browser

  1. Open try.milyo.app and drop the .xml file on File A or File B. Nothing is uploaded: the page's security policy only lets it talk to its own address.
  2. Go to Map columns. You see the file's row count and its first 20 rows, with the columns in the table above.
  3. Milyo suggests the mapping for you: Transaction ID from bank_ref, Date from booking_date, Reference from remittance, and the amount, currency and counterparty. Change any of them, then apply the mapping.

The matcher also lets you download the statement as a CSV: drop the file, then choose "Download as CSV".

Use the free converter

To get the CSV without matching anything, open try.milyo.app/camt053-to-csv, drop the .xml file and choose "Download CSV". You get one row per entry with the columns in the table above, in your browser, with nothing uploaded. Every entry is written, booked or not, with its status in a column.

A script for automation

If you convert statements on a schedule or in bulk, a script fits better than a web page. This is plain Python, with no packages to install. It writes the main columns from the table, for every entry, with the sign applied. It does not filter on status, so filter BOOK yourself. It is simpler than Milyo: it joins the remittance text of all transactions in an entry, where Milyo reads the first. We ran it on our .02 and .08 test files and on the sample statement. Run it as python3 camt2csv.py statement.xml > statement.csv.

import csv
import sys
import xml.etree.ElementTree as ET


def local(tag):  # drop the {namespace} part, so every version reads the same
    return tag.rsplit("}", 1)[-1]


def text_at(el, *path):  # text of the first element down this path, or ""
    for name in path:
        el = next((c for c in el if local(c.tag) == name), None)
        if el is None:
            return ""
    return (el.text or "").strip()


def day(el, name):  # YYYY-MM-DD from <Dt> or from the date part of <DtTm>
    return text_at(el, name, "Dt") or text_at(el, name, "DtTm")[:10]


def first(el, name):  # first descendant with this name, or None
    return next((e for e in el.iter() if local(e.tag) == name), None)


out = csv.writer(sys.stdout)
out.writerow(["booking_date", "value_date", "amount", "currency", "status", "bank_ref", "end_to_end_id", "remittance"])
for ntry in ET.parse(sys.argv[1]).getroot().iter():
    if local(ntry.tag) != "Ntry":
        continue
    amt = first(ntry, "Amt")
    sign = "-" if text_at(ntry, "CdtDbtInd") == "DBIT" else ""
    status = text_at(ntry, "Sts", "Cd") or text_at(ntry, "Sts")  # .08 nests the code in <Cd>
    e2e = first(ntry, "EndToEndId")
    out.writerow([
        day(ntry, "BookgDt"), day(ntry, "ValDt"), sign + amt.text.strip(), amt.get("Ccy"),
        status, text_at(ntry, "AcctSvcrRef"), e2e.text if e2e is not None else "",
        " ".join(e.text for e in ntry.iter() if local(e.tag) == "Ustrd"),
    ])

The amounts use a dot as the decimal mark. If your spreadsheet expects a comma, set the column's format when you import it.

Have a statement and a ledger to compare? Load both. No account. Your files stay in your browser.

Open the free matcher

Related guides