I encountered similar issues using Herique Bastos's gnucash-tobeancount
(https://github.com/henriquebastos/gnucash-to-beancount) and have seen
debanjum's changes (https://github.com/debanjum/gnucash-to-beancount).
Personally, I am using Gnucash with 17 years of data as my "master" data
and doing frequent exports to beancount. I was very reluctant to change the
Gnucash data. For this I modified my own copy of gnucash-to-beancount.
Seeing this thread inspired me to clean up my work and push it out to
github.
This version handles:
- Many types of special characters in account and commodity names
(spaces, commas, slash, underscore, period, percent, @, &, +, ?, ', (, ),
ยข).
- Joe's -> Joes
- 401(k) -> 401k
- CD @ 2% -> CD-at-2-pct
- Account names that start with '-' or a digit (401k -> X-401k)
- Account names that start with lower case (iBond -> IBond)
- Commodity names that have lower case or dashes or are longer than 24
characters.
- Notes with double quotes (")
- Accounts are open on the date of the first transaction
- Gnucash's hidden accounts are considered closed. I added close
directives for these.
- Accounts are closed on the day after the last transaction
- Skipping of Gnucash's placeholder accounts
- Commodity precision is retrieved from Gnucash
If anyone is interested, please give it a whirl. The code is
at https://github.com/AndrewStein/gnucash-to-beancount
On Thursday, August 31, 2017 at 2:03:11 AM UTC-5, Martin Blais wrote:
>
> On Wed, Aug 30, 2017 at 2:05 PM, <[email protected] <javascript:>> wrote:
>
>> Okay, I was finally able to run bean-check without any errors. I will
>> write down things I did in hopes that it will help someone else. I wouldn't
>> have been able to do with without folks on the IRC channel, they were
>> really helpful.
>>
>
> That's great!
>
>
>
>> The gnucash-to-beancount script opens all the accounts at the beginning
>> of the file but on some accounts the dates are later then some of the
>> transactions in the file, which produces the inactive account error. I
>> changed the dates for the opening statements to when the earliest
>> transaction was for that account. Then basically iterate this for the rest
>> of the accounts with the same error.
>>
>
> This would cause the second error you reported indeed. Beancount ignores
> the location of the directives in the file (on purpose).
>
>
> Another big problem was that fact that I had a lot of account names that
>> are valid in gnucash which aren't valid in beancount.
>> * Accounts starting with lowercase
>> * Accounts starting with numbers
>> * Accounts with & in their name (e.g., Expenses:Gas-&-Electric)
>> * Accounts with apostrophes
>>
>
> That's correct.
> I think the converter script could be modified to make reasonable account
> name conversions.
>
>
>
>
>>
>>
>>
>> On Wednesday, August 30, 2017 at 9:31:16 AM UTC-7, [email protected]
>> wrote:
>>>
>>> For what it's worth I have also tried gnucash2ledger and then
>>> ledger2beancount, but I get similar errors.
>>>
>>> On Wednesday, August 30, 2017 at 9:26:08 AM UTC-7, [email protected]
>>> wrote:
>>>>
>>>> I'd love to try beancount but I seem to be stuck trying to convert my
>>>> data from gnucash. I am using
>>>> https://github.com/debanjum/gnucash-to-beancount to convert 4 years of
>>>> gnucash data. When I run bean-check on the result file, I get a ton of
>>>> errors that look like
>>>>
>>>> /home/user1/beancount/foo.beancount:4505: Invalid token: 'taxed'
>>>> /home/user1/beancount/foo.beancount:4517: syntax error, unexpected
>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>> /home/user1/beancount/foo.beancount:4517: Invalid token: 'k'
>>>> /home/user1/beancount/foo.beancount:4522: Invalid token: 'taxed'
>>>> /home/user1/beancount/foo.beancount:4532: syntax error, unexpected
>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>> /home/user1/beancount/foo.beancount:4532: Invalid token: 'k'
>>>> /home/user1/beancount/foo.beancount:4537: Invalid token: 'taxed'
>>>> /home/user1/beancount/foo.beancount:4547: syntax error, unexpected
>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>> /home/user1/beancount/foo.beancount:4547: Invalid token: 'k'
>>>> /home/user1/beancount/foo.beancount:4552: Invalid token: 'taxed'
>>>> /home/user1/beancount/foo.beancount:4566: syntax error, unexpected
>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>> /home/user1/beancount/foo.beancount:4566: Invalid token: 'k'
>>>> /home/user1/beancount/foo.beancount:4571: Invalid token: 'taxed'
>>>> /home/user1/beancount/foo.beancount:4581: syntax error, unexpected
>>>> COLON, expecting EOL or COMMENT or ATAT or AT
>>>> /home/user1/beancount/foo.beancount:4581: Invalid token: 'k'
>>>> /home/user1/beancount/foo.beancount:4586: Invalid token: 'taxed'
>>>>
>>>>
>>>> followed by a ton of results like this
>>>>
>>>> /home/user1/beancount/foo.beancount:1168: Invalid reference to
>>>> inactive account 'Expenses:House:Appliances-and-Furniture'
>>>>
>>>> 2014-011-06 * "AMAZON.COM AMZN.COM/BI - Vornado fan"
>>>> notes: "OFX ext. info: |Trans type:Generic debit|Memo:FOOBAR
>>>> MERCHANDISE"
>>>> num: "12345023456233"
>>>> Liabilities:American-Express -107.760 USD
>>>> memo: "FOOBAR MERCHANDISE"
>>>> Expenses:House:Appliances-and-Furniture 107.760 USD
>>>>
>>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/fa929358-330c-4085-a3cf-9719be0e816b%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/beancount/fa929358-330c-4085-a3cf-9719be0e816b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/aa874475-975e-4b73-95ac-f2969178993b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.