Import customers re visited

Sébastien de Menten sdementen at gmail.com
Sat Jun 18 17:13:47 EDT 2016


Hello all,

For a relatively simple way to import customers into GnuCash, you can use
(at your own risk as any sqlite fiddling tool) piecash, a python library
referenced by Wm.
The python code to create a new customer is:

# import piecash
from piecash import open_book, Customer, Address

# open a book (does a backup=copy of the book each time)
with open_book("test_book.gnucash", readonly=False, do_backup=True,
open_if_lock=True) as book:
    # create a Customer
    Customer(name="Billy Foo Jr",
             currency=book.currencies(mnemonic="EUR"),
             address=Address(addr1="Xyz street"),
             book=book)

    # save the book
    book.save()

If you save this text in a file named add_customer.py and then run it with
'python add_customer.py', it will add the customer "Billy Foo Jr" to the
test_book.gnucash file (should be saved in sqlite).
You would have to install the piecash library before by running "pip
install piecash" on the command line.

Hope it helps...

kr

Seb




On Wed, Jun 15, 2016 at 10:29 PM, Wm <tcnw81 at tarrcity.demon.co.uk> wrote:

> On Wed, 15 Jun 2016 11:47:25 -0600, in gmane.comp.gnome.apps.gnucash.user,
> Wendell <wkrause at ncodesys.com> wrote:
>
> > Hello all
> > I am still trying to import customers into GNU via Sqlite. Lewis has
> > published a page to help people like me, however it does bot work for
> > me. I am using Ubuntu with the latest updates and GNU also with the
> > latest updates.
> > I suppose that during this time I could have re entered all of the
> > customers (325), But I still want to be able to help myself.
>
> Importing directly into an SQL db is not ever likely to work nicely unless
> you really know what you are doing, this is even more so for things on the
> business side of GnuCash.
>
> I'd have thought the obvious way to go would be to dump your customers from
> SQLite to text and proceed with a normal import procedure using a
> spreadsheet along the way as needed.  In fact this is exactly what Lewis
> does presuming my quick scan of
> www.keywild.com/gnucash/GNUCashSQLiteReports.pdf
> is what we are talking about.
>
> More generally "it's not working for me" doesn't provide much clue in how
> to help you.
>
> --
> Wm
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> 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