CSV Imports

Geert Janssens geert.gnucash at kobaltwit.be
Tue Oct 24 04:13:40 EDT 2017


Op dinsdag 24 oktober 2017 07:33:24 CEST schreef Nick Judd:
> Hello everyone,
> 
> I have been using Gnucash for personal accounting for the last couple of
> years. I have questions about CSV imports relevant to this thread:
> 
> https://lists.gnucash.org/pipermail/gnucash-user/2017-March/069914.html
> 
> 1. Using Gnucash 2.6.18, my experience is that it is not straightforward
> to import transactions from CSV using a CSV /I have generated using
> GNUCash/, into exactly the same account structure.
> 
> Am I missing something here?
> 
Yes. The thread you refer to talks about the CSV import improvements I have 
implemented in the development series. Anything in development will only 
appear in the next major release. In this case that will be 2.8 in a couple of 
months. If you're impatient, you can already test this functionality by 
downloading and installing gnucash 2.7.0, our first test release that will 
eventually lead up to gnucash 2.8.0. Do backup your data before you do so! 
There are still a few known crashers in that version (particularly on 
Windows). On the other hand your feedback would be greatly appreciated.

> 2. Looking over previous threads, I understand that Gnucash's CSV import
> cannot really handle multi-split transactions. I need multi-split
> transactions and I can code well in Python but am useless in Gnucash's
> native C/C++. The solutions that immediately come to mind are trying to
> shoehorn the data in using Gnucash's Python API (bad) or to use Python
> to reshape the CSV into a more Gnucash-friendly object (easier ->
> better). However, the threads I have seen focus more on the general
> notion that CSV import really isn't going to be ready for prime time
> until 2.8 than on the kinds of things CSV import can currently do well.
> I am interested in the latter.
> 

Indeed, the major improvements to the CSV importer will only appear as of 
2.7/2.8. The current CSV importer is pretty limited and was designed with only 
one fairly simple use case  in mind: import bank statements. These typically 
have very little data: a date, a (bank) transaction number, a description and 
an amount. This reflects in the column options you have available in the CSV 
importer. Bank statements don't have multi-split transactions, and one split 
is always implied (to be in the bank account for which you're importing the 
bank statement). Later a few additions were made to the CSV importer but 
multi-split was not one of those...

With that in mind you have only a few options IMO:
- wait for 2.8 (the easiest, but perhaps not viable for your situation)
- write a python script that does the import for you. There's no way the 2.6 
version of the CSV importer will correctly import multi-split transactions. It 
will always interpret each line as a separate transaction. So manipulating the 
csv file to that effect won't work.
- and perhaps one of the other import formats does support multi-split, but I 
have no experience with those. There is a utility on the net somewhere to 
convert xls files to qif. Perhaps that can be an alternative route.

Regards,

Geert


More information about the gnucash-user mailing list