beancount-dkb icon indicating copy to clipboard operation
beancount-dkb copied to clipboard

Has DKB's CSV file format changed for credit card transactions?

Open bjoseru opened this issue 1 month ago • 1 comments

Following a multi-year hiatus I am trying to resurrect my accounting system. I'm trying to import credit card transactions, and I know this has worked in the past, but somehow now it doesn't. I suspect that DKB has silently changed the format of the exported CSV file, but I have no old records to prove it.

Here's what the new file format looks like:

"Karte";"Visa Kreditkarte";"5678 •••• •••• 1234"
""
"Saldo vom 20.04.2024:";"--1234,56 EUR"
""
"Belegdatum";"Wertstellung";"Status";"Beschreibung";"Umsatztyp";"Betrag (€)";"Fremdwährungsbetrag"
"18.04.24";"";"Vorgemerkt";"Supermarkt";"Im Geschäft";"-21,8";""
"17.04.24";"";"Vorgemerkt";"TANKSTELLE";"Im Geschäft";"-62,05";""
"17.04.24";"18.04.24";"Gebucht";"DAS FUTTERHAUS";"Im Geschäft";"-52,97";""
"17.04.24";"18.04.24";"Gebucht";"Restaurant XYZ";"Im Geschäft";"-56,4";""
"16.04.24";"17.04.24";"Gebucht";"Baeckerei ABC";"Im Geschäft";"-7,19";""
...

Running bean-extract with configuration

from beancount_dkb import ECImporter, CreditImporter

CONFIG = [
    CreditImporter(
        "5678 •••• •••• 1234",
        'Assets:DKB:Credit',
        currency='EUR',
    )
]

on this file produces an empty output (execpt for the emacs mode-line) for me.

Looking at test files, my suspicion is that the first line has an unexpected format; If I add a hyphen to Visa-Kreditkarte and remove the subsequent ";" then I receive the error message

ERROR:root:Importer DKB CreditImporter.extract() raised an unexpected error: '"Belegdatum";"Wertstellung";"Status";"Beschreibung";"Umsatztyp";"Betrag";"Fremdwährungsbetrag"' is not in list
Traceback (most recent call last):
  File "/path/venv-3.12/lib/python3.12/site-packages/beancount/ingest/extract.py", line 182, in extract
    new_entries = extract_from_file(
                  ^^^^^^^^^^^^^^^^^^
  File "/path/venv-3.12/lib/python3.12/site-packages/beancount/ingest/extract.py", line 67, in extract_from_file
    new_entries = importer.extract(file, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/venv-3.12/lib/python3.12/site-packages/beancount_dkb/credit.py", line 100, in extract
    return self._extract(file, extractor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/venv-3.12/lib/python3.12/site-packages/beancount_dkb/credit.py", line 109, in _extract
    header_index = lines.index(extractor.HEADER)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: '"Belegdatum";"Wertstellung";"Status";"Beschreibung";"Umsatztyp";"Betrag";"Fremdwährungsbetrag"' is not in list
;; -*- mode: beancount -*-

I am using

beancount==2.3.6
beancount-dkb==0.19.0

with python v3.12.2. Thoughts and pointers will be appreciated, thank you.

bjoseru avatar May 10 '24 09:05 bjoseru