File export and year end data reduction

John Griessen john_g at cibolo.com
Tue Jan 2 10:10:19 EST 2007



Bob Allen wrote:
using your favorite editor find the first line starting
> <gnc:transaction....
> and the find the last line starting   </gnc:transaction....
> 
> and delete everything in between including those lines.

This is a good method for closing at year end.  It takes away any mistakes
coming from improper paying of invoices payable, and reduces the size of the 
data file so it's managable to load, while preserving customer info.

It keeps all invoice entriess though.  I find old invoices helpful to have on 
hand, but not all, so I am making an improvement on Bob Allen's data reducing 
year end idea.>

It will be a python script to use python XML features so I can search for all 
</gnc:GncEntry> . . .   </gnc:GncEntry>    XML stanzas, and delete the ones in a 
certain time period.  My program will be low on data storage space used, and 
just decide what to winnow out, storing one </gnc:GncEntry>  . . . 
</gnc:GncEntry>    XML stanza at a time, then writing out to a new file, and 
going through the whole .gnucash file.  It will take a command line argument 
that is the date year and month or many of those, so running it will look like:

gnucash-yearend-winnow  2005-08 2005-07 2005-06 2005-05 2005-04 2005-03 
file1.gnucash

and output to a file named file1.out.gnucash


To winnow again and take out more, just repeat using the output file.   When it 
loads and looks good in gnucash, rename it and start using it as your data file. 
  This can be done again at any later time, so deleting all transactions is the 
only critical thing to do at year end, then adjust all the starting balances, 
then do some data file winnowing whenever you have time.

My python script should be ready for all to use in a few days.

John Griessen

PS  Anyone in a rush can send me some tip money...and have the results to use 
forever as GPL'd FOSS.


More information about the gnucash-user mailing list