export general ledger

Wm wm_o_o_o at yahoo.co.uk
Mon Dec 18 06:27:55 EST 2017


On 18/12/2017 10:32, Jeff Abrahamson wrote:
> On 18/12/17 03:26, Wm via gnucash-user wrote:
>> On 17/12/2017 19:31, Jeff Abrahamson wrote:
>>> I'd like to export the general ledger to a csv file.  When I use File ->
>>> Export, however, I'm offered a choice of exporting income, expenses,
>>> assets, or liabilities.  But I'd like to have all transactions in the
>>> csv file.
>>>
>>> I think I see how to do this using python (the example script
>>> account_analysis.py in the examples is instructive).  But this seems so
>>> basic I suspect I'm missing something.
>>>
>>> Many thanks for any pointers.
>> May be easier to do a transaction report or similar and copy and paste
>> that into a spreadsheet.
>>
>> Alternatively there are a number of scripts that can take gnc files of
>> some flavour and produce ledger-cli / beancount compatible files which
>> are generally mores useful than csv files for accounting data anyway.
> 
> Ah, ledger-cli and beancount are neat, thanks for the pointer.
> 
> This sort of export is something I want to be able to do frequently.
> I'll have a look around for scripts to automate it.

The database formats of both gnc and the text accounting tools are 
pretty stable so once you get an export that works you won't have to 
fiddle with it much.  Only major decision is that you might have to 
switch to an sqlite backend if you are using xml at the moment (but the 
long term plan is for sqlite to be the default store anyway).

I've probably used most of the conversion scripts over time, let me know 
the gist of what you're trying to achieve and I'll dig through the ones 
I've used.

If you can read python it'll be plain sailing and the best place to 
start is probably Sebastien's work
https://piecash.readthedocs.io/en/latest/
he has a ledger-cli conversion and ledger-cli to csv (or gnc to csv if 
that is what you really want) is simple.

The point about using text accounting as an intermediary is that damn 
near everyone has had a kick at it so there is little you can't make it 
do or get out of (or into) it.

As an e.g. of frequent use (but probably in the opposite direction) I 
used ledger-cli to black box per month everything that happens for one 
of my p2p accounts that produces hundreds of transactions of less than a 
few pennies and with more than 2 decimal significance and just isn't 
worth replicating in gnc; ledger-cli produces a summary journal per 
month and I put *that* into gnc

-- 
Wm



More information about the gnucash-user mailing list