[GNC] Example of importing Stock transactions from CSV

Jack Frillman jcf_m_lists at me.com
Sat Aug 20 11:54:08 EDT 2022


I use CSV import almost every day and it works just fine.
You do have to setup a configuration file that tells the importer how to 
interpret your CSV data. I suspect you did not do that.
Here is an example of my CSV data:

ARSIX,14.82,Ray Jay,2022/08/20,USD
BAFGX,26.47,Ray Jay,2022/08/20,USD
BAGIX,10.07,Ray Jay,2022/08/20,USD
CISMX,16.75,Ray Jay,2022/08/20,USD
GSFTX,29.98,Ray Jay,2022/08/20,USD

Each column of the separated values above are defined when you set the 
importer up.
I saved this in a file called "ira quotes" and it's selected in the 
attached screen shot.  The bottom window is the result of mapping of the 
"irs quotes" file to the CSV data above.

As for your Python script I have no idea what it's supposed to do.
I have a much smaller Python script that scrapes the closing day prices 
off a web page and creates the CSV file I import.

Jack

On 8/19/22 10:33 PM, Jon Schewe wrote:
> 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.
>
> _______________________________________________
> 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.

-- 
Old Unix programmers never die, they just mv to /dev/null
- Anonymous
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2022-08-20 at 11.41.27 AM.png
Type: image/png
Size: 184750 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20220820/b07957ee/attachment-0001.png>


More information about the gnucash-user mailing list