Revised handling of CSV files from financial institutions
John Lewis have changed their credit card download format yet again. The changes required some additional configurability to be added to mkqif.py
The modifications consist of:
- Handle positive debit values; additional debit_is_negative configuration flag
- Change credit_flag to credit_regexp
- Handle credit_regexp in payee column
- Ignore (but count) date format errors; ignore pending transactions
- Remove spaces and commas from amount and credit values
Here's a (fictious) example of a mkqif.cfg file, configuring a Barclay's credit card statement:
; This is a comment [parameters] output_dir=~/QIF source_dir=~/Downloads [barclays] ; type of account - CCard (default) or Bank type=Bank ; Number of header lines to skip in CSV nheaders=2 ; Number of columns expected in CSV ncols=4 ; CSV column containing xcn date date_col=0 ; CSV column containing payee name payee_col=1 ; CSV column containing debit amount debit_col=2 ; CSV column containing credit amount (or flag) credit_col=3 ; debit values are positive (i.e. not QIF-like) debit_is_negative=False ; regexp to select source CSV files file_regexp=barclays.*csv ; format of xcn date (e.g. 05/Jun/2020) date_format=%d/%b/%Y ; regexp to indentify credit is in debit column credit_regexp=PAYMENT.*
Update: 2022-06-24
Source code for mkqif.py
is now available on Github.