piecash icon indicating copy to clipboard operation
piecash copied to clipboard

Ledger export format error

Open andrew521 opened this issue 3 years ago • 4 comments

It seems that some records do not have proper format

2021-08-27 Buy 1 x COST211015C00435000 @ 4.73
	* Assets:Investments:IBKR Uxxxxxxx:US:USD  USD -2,038.00
	Assets:Investments:IBKR Uxxxxxxx:US:USD  USD -0.70
	Expenses:Brokerage:IB:USD                 USD 0.70
	Assets:Investments:IBKR Uxxxxxxx:US:COST211015C00435000  COST211015C00435000 100.0000 @@ USD 2,038.00

rejected by ledger-cli with this error:

While parsing file "gnucash.ledger", line 117651:
While parsing posting:
  Assets:Investments:IBKR Uxxxxxxx:US:COST211015C00435000  COST211015C00435000 100.0000 @@ USD 2,038.00
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unexpected char 'C' (Note: inline math requires parentheses)

andrew521 avatar Sep 27 '21 21:09 andrew521

I receive similar errors. I believe it is a result of the fact that ledger-cli is much more restrictive about how commodities can be named than GnuCash. Commodity names with spaces, full stops, dashes or numbers appear to generate errors in ledger-cli.

bunburya avatar Jan 31 '22 23:01 bunburya

https://ledger-cli.org/doc/ledger3.html#Naming-Commodities

Commodity names can have any character, including white-space. However, if you include white-space or numeric characters, the commodity name must be enclosed in double quotes ‘"’:

andrew521 avatar Aug 14 '23 19:08 andrew521