Re: I get "Error: Only one posting with null amount allowed per transaction" when importing CSV file

34 views
Skip to first unread message

Husain Alshehhi

unread,
May 25, 2023, 9:01:58 AM5/25/23
to ledge...@googlegroups.com

I saw this previous thread:

https://groups.google.com/g/ledger-cli/c/D75Mr05b_RM

The user had a similar issue to mine, and when I changed the file to:

--8<---------------cut here---------------start------------->8---
date,,,payee,,debit,amount
2023-04-22,2023-04-24,0311,COSTCO WHSE#1322,Merchandise,,10.99
--8<---------------cut here---------------end--------------->8---

(notice the "amount" field name) it worked. This is strange as the csv.h
file documents both the debit field and the credit field.

https://github.com/ledger/ledger/blob/master/src/csv.h#L64-L65

This is also documented in the docs online. Requiring "amount" only is
somewhat inconvenient. Is this a bug?

Husain Alshehhi

unread,
May 25, 2023, 9:01:58 AM5/25/23
to ledge...@googlegroups.com

Hello,

A new user to ledger here. I have a tmp.csv file that contains the
following:

--8<---------------cut here---------------start------------->8---
date,,,payee,,debit,credit
2023-04-22,2023-04-24,0311,COSTCO WHSE#1322,Merchandise,,10.99
--8<---------------cut here---------------end--------------->8---

But I get an error when running the command:

husain@localhost:~/Finance$ ledger convert tmp.csv --input-date-format "%Y-%m-%d" --rich-data -f personal.dat
While parsing file "/home/husain/Finance/tmp.csv", line 1:
While parsing CSV line:
2023-04-22,2023-04-24,0311,COSTCO WHSE#1322,Merchandise,,10.99

Error: Only one posting with null amount allowed per transaction

I get the same error as well if I run the following:

husain@localhost:~/Finance$ ledger convert tmp.csv --input-date-format "%Y-%m-%d" --rich-data -f personal.dat --account Assets:Bank --invert
While parsing file "/home/husain/Finance/tmp.csv", line 1:
While parsing CSV line:
2023-04-22,2023-04-24,0311,COSTCO WHSE#1322,Merchandise,,10.99

Error: Cannot negate an uninitialized amount

I am not sure what is going on. Guidance would be appreciated.

Note that I am running into this issue after consulting the
documentation in:

https://ledger-cli.org/doc/ledger3.html#The-convert-command

The documentation includes a command similar to the one listed above. I
also consulted the man page. However, the man page is not clear on how
to use the convert command as it does not group the options together. I
am, for example, unsure what the "-f" flag does here.


Thanks,
Husain

Reply all
Reply to author
Forward
0 new messages