[GNC] Example of importing Stock transactions from CSV

Jon Schewe jpschewe at mtu.net
Fri Aug 19 22:33:57 EDT 2022


So I didn't get the CSV import tool to work. However I was able to
write a python script to do the import. I would think that this would
be possible with the CSV import, but I can't seem to figure out how to
do the right column assignments to make it work. I have attached the
python script and a sample input CSV file.

If someone that knows how the CSV import code works and can compare
with my script and tell me how to use the CSV import tool for this,
that would be great.

Thanks,

Jon


On Tue, 2022-07-12 at 08:45 -0500, Jon Schewe wrote:
> That looks similar to what I'm doing, except all of my data is on a
> single line in the CSV file. The biggest problem seems to be how to
> convince GnuCash to use 2 different commodities for the transaction
> when importing from CSV.
> 
> 
> On Tue, 2022-07-12 at 13:04 +1000, Geoff wrote:
> > Hi Jon
> > 
> > This isn't exactly what you are asking for, but it may give you
> > some 
> > clues.  Importing Dividends from CSV:-
> > 
> > https://lists.gnucash.org/pipermail/gnucash-user/2020-August/092768.html
> > 
> > 
> > Good luck!
> > 
> > Geoff
> > =====
> > 
> > On 12/07/2022 12:35 pm, Jon Schewe wrote:
> > > Does anyone have an example of importing stock transactions from
> > > CSV?
> > > 
> > > I have matched columns to Date, Description, Account, Price,
> > > Deposit,
> > > Transfer Account.
> > > The "Account" column is the mutual fund account.
> > > The "Transfer Account" column is the currency account.
> > > 
> > > When I start the import process all of my transactions need an
> > > account
> > > to transfer from, despite specifying the Transfer Account. When I
> > > try
> > > and select my currency account I'm told that it has the wrong
> > > commodity.
> > > 
> > > I have another column for the currency amount, but I don't know
> > > what to
> > > map that to in the importer.
> > > 
> > > I tried checkout out
> > > https://www.gnucash.org/docs/v4/C/gnucash-help/trans-import.html#trans-import-csv
> > > 
> > >   but it doesn't seem to address this.
> > > Suggestions on where I'm going wrong.
> > > 
> > > Jon
> > > 
> > > 
> > > _______________________________________________
> > > 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
> > > 
> > > If you are using Nabble or Gmane, please see 
> > > https://wiki.gnucash.org/wiki/Mailing_Lists
> > >  for more information.
> > > -----
> > > Please remember to CC this list on all your replies.
> > > You can do this by using Reply-To-List or Reply-All.
> 
> _______________________________________________
> 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
> If you are using Nabble or Gmane, please see
> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: import_alight.py
Type: text/x-python3
Size: 9147 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20220819/b957132e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.csv
Type: text/csv
Size: 482 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20220819/b957132e/attachment.csv>


More information about the gnucash-user mailing list