[GNC] How to bulk import about 130 Securities entries?
Geoff
cleanoutmyshed at gmail.com
Sun Aug 14 01:38:55 EDT 2022
Hi Jim
I don't have any experience manipulating GnuCash XML files, but in
principle what you want to do should work, although it does void your
GnuCash warranty.
However, if you are going to all this effort you may find it more
worthwhile to invest your time in learning how to use a general purpose
automation tool. This approach has two advantages over data manipulation:
(1) Automation drives the GnuCash GUI and thus protects you from
accidental data corruption.
(2) You will be able to use your new automation skills to automate any
subsequent GnuCash tasks, for example loading historical transactions to
your 130 securities.
For Windows, check out:
AutoHotKey https://www.autohotkey.com/
or:
Power Automate Desktop https://powerautomate.microsoft.com/en-us/desktop/
I can't recommend anything for Linux, but Google is your friend:
https://alternativeto.net/software/autohotkey/?platform=linux
Hope this helps.
Regards
Geoff
=====
On 14/08/2022 11:28 am, Jim DeLaHunt wrote:
> Hello, folks:
>
> I am a long-time GnuCash user, and for all those years I have pretty
> much not attempted to track my investments in GnuCash. But now I want to
> start. My first goal is to import many years of past activity.
>
> I have downloaded the transactions from my brokerage account as a CSV
> file. The first thing I get out of this is the name and symbol of about
> 130 securities. I am wondering if there is a practical way to bulk
> import these into GnuCash. That is, instead of visiting Tools --
> Security Editor, and pressing the Add button 130 times, and filling out
> the "New security" dialogue 130 times, is there a more efficient path?
>
> Looking at the File… Import menu, I do not see an option to import
> Securities. Looking at the documentation, wiki, and list archives, I
> don't see a mention of this. Is there some bulk import mechanism I am
> overlooking?
>
> I took a look at the uncompressed XML contents of a new, simple .gnucash
> book file. It appears that the data entered in the "New security"
> dialogue gets stored as <gnc:commodity> entities. There appears to be a
> pretty simple relationship between the fields of the dialogue and the
> text within the <gnc:commodity> entity. The entities are stored in a
> certain order, sorted by <cmdty:space> then <cmdty:id>. There is a
> <gnc:count-data cd:type="commodity"> entity which seems to contain a
> text count of the non-CURRENCY gnc:commodity entries.
>
> This makes me wonder if I could transform my list of 130 security names
> and symbols into <gnc:commodity> entities, and insert them into the
> GnuCash XML of my book.
>
> Are there complexities or pitfalls about this approach which I might be
> overlooking? We can certainly stipulate that manipulating the XML
> content directly is unsupported and risky, I must be careful and keep
> backups, I might blow off my fingers, etc. For what it's worth, I
> believe that I am pretty proficient with editing XML, processing CSV
> files, and scripting manipulations of text data.
>
> Once I have the securities added to the book, I then need to add the
> appropriate child accounts to my brokerage accounts, each denominated in
> the appropriate security type and symbol. It looks like that is
> straightforward to do with a CSV of accounts in the correct format, and
> the File… Import… Import Accounts from CSV… menu item. I have a few
> child accounts which I entered from the UI which will serve as
> examples. Is there any way in which this is more difficult than it looks?
>
> Cheers,
> —Jim "ADBE ALNIX AOL … VUG VWO ZTD81" DeLaHunt
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-user
mailing list