When trying the to import a csv file from my bank:
$ hledger -f myfile.csv print
hledger: myfile.csv: hGetContents: invalid argument (invalid byte sequence)
When trying the to import a csv file from my bank:
$ hledger -f myfile.csv print
hledger: myfile.csv: hGetContents: invalid argument (invalid byte sequence)
If it's just with this CSV file, https://hledger.org/1.42/hledger.html#encoding will probably be enough. (If you have hledger 1.42; 1.42.1 has minor fixes and is preferred.)
And there's more general discussion of this at https://hledger.org/install.html#text-encoding. Sorry..
G'morning & thanks for the quick reply. I noticed it was isolatin and thought choosing utf-8 in libre-office (and save) would be enough but I guess that just is for how the characters are shown. Somehow managed to solve it in emacs. Next time I'll look into setting encoding in the rules file
How do I specify the date format when it looks like: 2025-04-08
?
$ hledger -f my.csv print
hledger: error: could not parse "Bokfdag" as a date using date format "%Y-%m-%d"
record values: "Radnr","Clnr","Kontonr","Produkt","Valuta","Bokfdag","Transdag","Valutadag","Referens","Text","Belopp","Saldo"
the date rule is: %6
the date-format is: %Y-%m-%d
You need
skip 1
to skip that header line.
Yes, but still some trouble with the date:
$ hledger -f my.csv print
hledger: error: could not parse "2025-04-08" as a date using date format ""
record values: "1","12","345,"Företagskonto","SEK","2025-04-08","2025-04-08","2025-04-08","comment","comment","55","60"
the date rule is: %6
the date-format is:
you may need to change your date rule, change your date-format rule, or change your skip rule
for m/d/y or d/m/y dates, use date-format %-m/%-d/%Y or date-format %-d/%-m/%Y
Check out this part from the manual: https://hledger.org/1.42/hledger.html#date-format
Now the date format seems empty. ^
Double check your rules ?
(date-format %Y-%m-%d
would be correct, but is redundant since that format is handled automatically)