ledger convert csv problems

194 views
Skip to first unread message

Nikos Charonitakis

unread,
May 17, 2020, 3:47:18 AM5/17/20
to Ledger
Hi all

I am trying to use ledger convert on a credit card statement.
I edited it a bit in order to be more compatible with ledger convert command:

My bank uses (;)to seperate fields so i replaced them all with (,)
I ended with these sample lines but it shows errors in date and in the first line

(Fields are:
transaction number,transaction date,processed date,reference code,payee Amount  (EUR),Credit or Debit)
,date,,code,payee,amount,,                    
1,15/5/2020,15/5/2020,"31412035","paid - thank you  ",39.16,D,                
2,26/4/2020,28/4/2020,"23521954","COFFE ISLAND",2.30,C,


command:
ledger convert -f Cards_test1.csv --input-date-format "%d/%m/%Y"

errors:
line 1:Error: Directive ',date,,code,payee,amount,,' requires an argument

line 2:Error: Invalid date: 1,15/5/2020,15/5/2020,"31412035","pay

what i am doing wrong?

Yuri Khan

unread,
May 17, 2020, 4:54:35 AM5/17/20
to Ledger
On Sun, 17 May 2020 at 14:47, Nikos Charonitakis <nik...@gmail.com> wrote:

> command:
> ledger convert -f Cards_test1.csv --input-date-format "%d/%m/%Y"
>
> errors:
> line 1:Error: Directive ',date,,code,payee,amount,,' requires an argument
>
> line 2:Error: Invalid date: 1,15/5/2020,15/5/2020,"31412035","pay
>
> what i am doing wrong?

‘ledger convert’ accepts the CSV file as a positional argument, not
named ‘-f’ option. With ‘-f’, Ledger is trying to read your CSV as if
it were a Ledger file.

Nikos Charonitakis

unread,
May 17, 2020, 5:58:39 AM5/17/20
to Ledger
thanks, but now i have a new problem:


ledger convert
Cards_test1.csv
Error: No journal file was specified (please use -f)

Yuri Khan

unread,
May 17, 2020, 6:24:12 AM5/17/20
to Ledger
On Sun, 17 May 2020 at 16:58, Nikos Charonitakis <nik...@gmail.com> wrote:

> ledger convert Cards_test1.csv
> Error: No journal file was specified (please use -f)

So you need to pass -f with your normal Ledger file, *and* your CSV
file as a positional argument.

o1bigtenor

unread,
May 17, 2020, 7:34:42 AM5/17/20
to Ledger
Hmmmmmmm - - - - no programmer here and trying to understand (maybe I could use
this technique).

So the command should be :
ledger -f /location/of/file convert Cards_test1.csv
--input-date-format "%d/%m/%Y"

or

ledger convert -f /location/of/file Cards_test1.csv
--input-date-format "%d/%m/%Y"

TIA

Yuri Khan

unread,
May 17, 2020, 7:54:44 AM5/17/20
to Ledger
On Sun, 17 May 2020 at 18:34, o1bigtenor <o1big...@gmail.com> wrote:

> So the command should be :
> ledger -f /location/of/file convert Cards_test1.csv
> --input-date-format "%d/%m/%Y"
>
> or
>
> ledger convert -f /location/of/file Cards_test1.csv
> --input-date-format "%d/%m/%Y"

Both work. I mostly work with a single ledger file, so I find it
easiest to just configure it in my ~/.ledgerrc.

o1bigtenor

unread,
May 17, 2020, 8:48:31 AM5/17/20
to Ledger
Thanks

Nikos Charonitakis

unread,
May 17, 2020, 8:53:43 AM5/17/20
to Ledger
yes, i managed to jump to other errors...
maybe i need to study more this command

i modified the csv file to look:
,date,,code,payee,amount,                    
1,15/5/2020,15/5/2020,"31412035","paid - thank you  ",EUR 39.4,              
2,26/4/2020,28/4/2020,"23521954","COFFEE", EUR -2.1,

then
ledger -f myfile.ldg convert Cards_test1.csv --input-date-format "%d/%m/%Y"

Error: Incorrect use of thousand-mark period

I am giving up for today :)
Reply all
Reply to author
Forward
0 new messages