Hi,

Thanks everybody for your fine pieace of software, which I 
use every week or so to keep track of my personal finances. 
I really appreciate it.

Since I switched to GnuCash two years ago, I wanted to be 
able to import the old accounting data into it. Not having 
enough time to dwelve into this problem, some time passed.
(And I have not written a single line in Scheme, so the 
source code was not a easy reading for me. Neither seemed 
the Quicken format to be a easy one).

The data I had was in a simple clean text format though I 
knew it would be easy to parse it, but a bit more 
complicated to transform it into the GnuCash format. But 
the transformation to the XML format was welcomed by me.
A couple of weeks ago I stumbled about REXML a XML-parser 
for Ruby, so I decided to write a small script and it 
proved to be quite easy, and I successfully converted all 
my old accounting data to GnuCash. (Well some very old is 
in a binary format which the newest version of this 
commercial products doesn't open any more .-)

I have seen that you are trying now to some more work for 
importing (HBCI) and hope you succeed with. I will give the 
source code a look, but I do not know whether I will have 
some time to lend a hand.

Could somebody give it a look? Is it good enough to be 
added to the GnuCash, may be just somewhere as a not so 
much supported utility? I think for the one time job of 
importing old data it might be simple to understand than 
the whole bunch which forms GnuCash.

Now follows the gnc_import.README
Readme for gnc_import.rb
------------------------

09-June-2002 Original version by Niklaus Giger [EMAIL PROTECTED]

gnc_import.rb is a utility script to convert foreign 
accounting data into GnuCash.
It was written to import data produced by Cashbook (a swiss 
accounting program)
and MacHaBu (a german accounting program), and worked for 
my purposes well enough.

If you send me examples of human readible text files  
produced by other 
accounting programs, which you would like to import into 
GnuCash I will try to 
adapt this utility to fit your needs (in the limits of 
spare time I have).
A description (if available) and a sample file/s including 
a few accounts
and transactions should suffice.

If this utility get accepted into the GnuCash code, I will 
add a generic text
module which would allow to import all fields of the 
account and transaction
records supported by GnuCash. Support for multiple splits 
in one transaction
will only be added if I get hand on samples of real output 
of another
accounting program.

I have no intentions to make this utility acapable of 
reading such a brain
damaged data format like Quicken.


Prerequisites:
--------------

1) You need ruby (I am running version 1.6.7). Which is 
available as
a Debian package or can be downloaded from 
http://www.ruby-lang.org

1) You need REXML. A XML parser for Ruby, in Ruby.
URL: http://www.germane-software.com/software/rexml
Many thanks to its author: Sean Russell 
<[EMAIL PROTECTED]> who 
answered my silly questions a quickly fixed a bug in the 
XML-output.
You need version 2.3.4 (30-May-2002) or later.


Things to change in gnc_import.rb before importing your 
data.
-------------------------------------------------------------

a) Look for Currency and CurrencySCU and change them to 
your local currency.
b) Change RecordSep to match your text files (e.g. 
Mac/Win/Unix convention)

If I get enough user feedback, I will let my uses be able 
to specify this 
interactively or through program switches.


Testing
-------

Try the following commands
$ ./gnc_import.rb tst_cashbook.accounts 
tst_cashbook.journal tst_cashbook
$ gnucash tst_cashbook
It should generate a valid GnuCash data file, after having 
complained about
invalid data like
Cannot represent dates before 1970. Line 26.07.1920     
Jazzschuhe Cynthia\
      11      3030    1000    145.00


Assumptions
-----------

In order to simplify my first tests I made the following 
assumptions for the data imported,
which were all guaranteed by the exporting applications.

Assumption 1:
All transaction are made in the same currency.

Assumption 2:
A transaction always consists of exactly two splits. One 
for debit and one for credit

Assumption 3:
Accounts are uniquely identified by their code number, a 
integer.

Assumption 4:
All amounts are specified in dollar/cents.(SCU is 100).


Open issues:
------------

Format for numbers and dates is fixed. E.g. 31.12.1998 for 
dates
and 5'489.45 or 5489.45 for 


Utility scripts to import foreign encoding (Mac, Windows, 
etc)
--------------------------------------------------------------

Before my financial information was handled on my Mac. I 
used
the following small script to convert its encoding to the 
one
normally used in Western Europe on my GNU/Linux system 
(running
Debian).

The input files were all named *.txt and converted to *.iso.

iconv --list

gives you a list of all supported encodings.

#! /usr/bin/zsh
for i in *.txt
do
  echo i ist $i outputname ist ${i/.txt/.iso}
  iconv -f MAC -t iso8859-1 $i --output ${i/.txt/.iso}
done

Limitations:
------------

The XML-building process is quite slow and consumes a lot 
of memory.
E.g. importing 70 accounts and about 1300 transactions 
takes about
3 minutes and 60 MB on my 500 AMD system with 192 MB RAM. 
The produced
file is about 1.4 MB. Balance and Loss/Profits show the 
correct totals.
If I go to the general ledger, I do not see any entries. I 
have to 
select Register..Date Range..Select all

If you have any problems do not hesitate to contact me 
([EMAIL PROTECTED]).

Regards
-- 
Niklaus Giger
Wieshoschet 6
CH-8753 Mollis
[EMAIL PROTECTED] Tel. G: +41 55 618 64 68, P: +41 55 612 20 54

Attachment: gnc_import.tar.gz
Description: GNU Zip compressed data

Reply via email to