[GNC] How to bulk import about 130 Securities entries?

john jralls at ceridwen.us
Tue Aug 16 22:54:01 EDT 2022



> On Aug 16, 2022, at 2:11 PM, Robert Simmons <rsimmons0 at gmail.com> wrote:
> 
>> running the *.gnucash through gunzip, add in the text, and run it back
> through gzip
> 
> As a connoisseur of bad ideas for adding data to GnuCash myself, I have to
> point out that one should use a programming language that has a library
> with support for the structured data format that one wants to add to. You
> use the parser provided by the language to generate objects in that
> language. You then perform operations on those objects. Finally, you use
> the library function to emit well formatted structured data.

Not that I would suggest altering your GnuCash data outside of the GnuCash library...

Gnome's libxml2 XML library is reasonably comprehensive, widely supported with bindings, and 
one heck of a lot less weighty than the Apache equivalent.

You also don't need to re-gzip the file. As long as you don't break anything GnuCash doesn't care
whether it's gzipped or not.

OTOH I'm pretty sure that gnc_commodity is fully exposed to the Python bindings so you should 
be able to write a python script using them to do the same thing without voiding your warranty
or needing to unzip the file or, for that matter, caring which backend is used.

Regards,
John Ralls



More information about the gnucash-user mailing list