[GNC] Export-import GnuCash historical prices

Patrick James patrickjames14 at comcast.net
Tue Nov 25 15:11:33 EST 2025


This is not going to work well with the default XML file format.

Also if someone is not familiar with SQL commands, then even the elementary SELECT is going to be a bit foreign, especially when using the AS in the FROM section.

So starting with the default XML, "save as" sqlite, and then...

> On 11/25/2025 11:35 AM PST sunfish62--- via gnucash-user <gnucash-user at gnucash.org> wrote:
> 
>  
> If you open your data file with an sql reader (Windows has DB Browser for SQLite https://sqlitebrowser.org/), you can use this command in the SQL window to retrieve a listing. 
> 
> ⁣David T. ​
> 
> On Nov 26, 2025, 12:44 AM, at 12:44 AM, David Carlson <david.carlson.417 at gmail.com> wrote:
> >I have no idea what to do with that paragraph
> >
> >
> >On Tue, Nov 25, 2025 at 1:01 PM sunfish62 at yahoo.com
> ><sunfish62 at yahoo.com>
> >wrote:
> >
> >> I don't know if this will help, but try it and see what you get. I
> >believe
> >> it also gives the number of shares owned, but it's been a while.
> >>
> >> SELECT c.mnemonic, c.guid,
> >>   ROUND(SUM((s.quantity_num*1.0/s.quantity_denom)),
> >> LENGTH(REPLACE(c.fraction, '1', ''))),
> >>   MIN(t.post_date), MAX(t.post_date)
> >>   FROM accounts as a, commodities as c, splits as s, transactions as
> >t
> >>   WHERE (a.account_type='MUTUAL' OR a.account_type='STOCK')
> >>   AND a.guid=s.account_guid AND s.tx_guid=t.guid AND
> >> a.commodity_guid=c.guid
> >>   GROUP BY c.mnemonic
> >>
> >> ⁣David T.​
> >>
> >> On Nov 25, 2025, 7:48 PM, at 7:48 PM, David Carlson <
> >> david.carlson.417 at gmail.com> wrote:
> >> >I recently lost most of the historical prices out of my main data
> >file.
> >> > I
> >> >have backups with the old price data intact.  I want to export them
> >> >from a
> >> >backup and import them into my current file.  I have saved the
> >backup
> >> >in
> >> >mysql format and found the price table but it is using guid's
> >instead
> >> >of
> >> >currency names and commodity names.  I don't know how to create a
> >> >proper
> >> >csv file to import the prices into my current data file.  Has anyone
> >> >done
> >> >something similar in the past?
> >> >
> >> >--
> >> >David Carlson
> >> >_______________________________________________
> >> >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.
> >>
> >>
> >
> >-- 
> >David Carlson
> _______________________________________________
> 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