reubano / csv2ofx

A Python library and command line tool for converting csv to ofx and qif files
MIT License
199 stars 113 forks source link

Possible mapping problem: Invalid number format #98

Closed swaggerino closed 1 year ago

swaggerino commented 1 year ago

Hi, I'm getting this error "Possible mapping problem: Invalid number format for 0,99.." When my CSV file contains a line with an amount of '0,xx' The moment i replace the 0 with something else or put a minus infront it runs fine.. What is going on?

My test csv:

"Umsatz abgerechnet und nicht im Saldo enthalten";"Wertstellung";"Belegdatum";"Beschreibung";"Betrag (EUR)";"Ursprünglicher Betrag";
"Ja";"23.11.2022";"22.12.2022";"test";"0,99";"";
reubano commented 1 year ago

Can you post the complete stack trace?

ondohotola commented 1 year ago

run it through something like

qsv input -d';' old.csv | qsv apply operations currencytonum 5 >new.csv

and see what that does.

I get a number of different CSV formats from a number of different banks and I use qsv and mlr a lot to produce sane formats :-)-O via a bash function loaded at login.

swaggerino commented 1 year ago

Can you post the complete stack trace?

csv2ofx -x ./mappingDKBvisa.py bankvisa2.csv
after_comma: None
after_decimal: None
usage: csv2ofx [options] <source> <dest>

description: csv2ofx converts a csv file to ofx and qif

positional arguments:
  source                the source csv file (default: stdin)
  dest                  the output file (default: stdout)

options:
  -h, --help            show this help message and exit
  -a TYPE, --account TYPE
                        default account type 'CHECKING' for OFX and 'Bank' for QIF.
  -e DATE, --end DATE   end date (default: today)
  -l LANGUAGE, --language LANGUAGE
                        the language (default: ENG)
  -s DATE, --start DATE
                        the start date
  -y, --dayfirst        interpret the first value in ambiguous dates (e.g. 01/05/09) as the day
  -m MAPPING_NAME, --mapping MAPPING_NAME
                        the account mapping (default: default)
  -x FILE_PATH, --custom FILE_PATH
                        path to a custom mapping file
  -c FIELD_NAME, --collapse FIELD_NAME
                        field used to combine transactions within a split for double entry statements
  -C ROWS, --chunksize ROWS
                        number of rows to process at a time (default: 2 ** 14)
  -r ROWS, --first-row ROWS
                        the first row to process (zero based)
  -R ROWS, --last-row ROWS
                        the last row to process (zero based, negative values count from the end)
  -O COLS, --first-col COLS
                        the first column to process (zero based)
  -L, --list-mappings   list the available mappings
  -V, --version         show version and exit
  -q, --qif             enables 'QIF' output instead of 'OFX'
  -o, --overwrite       overwrite destination file if it exists
  -D DATE, --server-date DATE
                        OFX server date (default: source file mtime)
  -E ENCODING, --encoding ENCODING
                        File encoding (default: utf-8)
  -d, --debug           display the options and arguments passed to the parser
  -v, --verbose         verbose output
Possible mapping problem: Invalid number format for `0,99`.. 
swaggerino commented 1 year ago

run it through something like

qsv input -d';' old.csv | qsv apply operations currencytonum 5 >new.csv

and see what that does.

I get a number of different CSV formats from a number of different banks and I use qsv and mlr a lot to produce sane formats :-)-O via a bash function loaded at login.

thanks! whatever it is doing, parsing the new csv works fine