Convert TopCard Service Switzerland credit-card CSV to MT940 for double-entry accounting and personal finance tools such as Banana Accounting (CH) and StarMoney (import).
- Pure Python 3 (no extra packages required)
- macOS / Linux / Windows compatible
- StarMoney-optimized profile writes SEPA keys in
:86:
(EREF+
,SVWZ+
, optionalPURP+
) and standard:61
codes (e.g.,NTRF
)
# 1) Make sure Python 3 is installed
python3 --version
# 2) Clone the repository
git clone https://github.com/worryboy/csv2mt940.git
cd csv2mt940
# 3) Run conversion (StarMoney import optimized)
python3 csv2mt940.py -p starmoney input.csv output.sta
Optional setup on macOS:
# Install Homebrew (if not already installed): https://brew.sh
brew install python
python3 csv2mt940.py [OPTIONS] input.csv output.sta
Important: -p/--profile
and -d/--debug
cannot be used together.
Choose either a profile or debug mode.
Short | Long form | Description |
---|---|---|
-p |
--profile |
Output profile: starmoney , plain |
-d |
--debug |
Debug table output |
--encoding |
CSV encoding (default: iso-8859-1 ) |
|
--delimiter |
CSV delimiter (default: ; ) |
|
--limit N |
Process only first N rows |
|
--ttype CODE |
Transaction type in :61 (default: NTRF in starmoney mode) |
|
--eref VALUE |
EREF+ value for :86: (default: NONREF ) |
|
--purp CODE |
Optional PURP+ code for :86: |
|
--suppress-balances |
Skip writing :60F/:62F balances |
1) StarMoney import (recommended)
python3 csv2mt940.py -p starmoney input.csv output.sta
2) Plain MT940 (generic)
python3 csv2mt940.py -p plain input.csv output.sta
3) Debug mode
python3 csv2mt940.py -d input.csv output.sta
4) Only first 10 transactions
python3 csv2mt940.py -p starmoney --limit 10 input.csv output.sta
5) UTF-8 CSV, custom type and EREF
python3 csv2mt940.py -p starmoney --encoding utf-8 --ttype NMSC --eref E2E123 input.csv output.sta
Expected columns (0-based):
- [1] account number
- [3] value date (
DD.MM.YYYY
) - [4] comment / purpose text
- [5] tags (comma-separated)
- [7] currency (EUR, CHF …)
- [10] amount debit/credit
- [11] alternate amount (used if col 10 empty)
- [12] booking date (
DD.MM.YYYY
)
Other notes:
- First 2 header rows are skipped automatically
- Footer lines starting with
;;;;Total
are ignored - Either col 10 or col 11 must contain the amount
:86:
contains SEPA keys so StarMoney can parse fields cleanly:EREF+
→ End-to-End referenceSVWZ+
→ Purpose / comment textPURP+
→ Optional SEPA purpose code
:61
uses standard SWIFT codes (defaultNTRF
, can be changed with--ttype
)- Comma
,
is used as decimal separator (required by MT940 spec) - Balances (
:60F
/:62F
) are optional and can be suppressed with--suppress-balances
- Best results in StarMoney 14+ with
-p starmoney
profile
Clone once:
git clone https://github.com/worryboy/csv2mt940.git
cd csv2mt940
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
See the LICENSE file for full details.