Writing a script to import bank's csv file

Mike or Penny Novack stepbystepfarm at mtdata.com
Mon Feb 10 08:35:57 EST 2014


Brendan S wrote:

>Hi
>I'm not really a gnucash user, but I want to use it to get some idea about
>where my money is going.  I am writing a (python) script to:
>* take a csv export from my bank account
>* split it into transactions
>* assign each transaction to an account (based on the vendor name); and
>* write a qif file for import into gnucash. 
>
>I would be interested to know how I should go about naming the accounts.  At
>the moment, I am putting most transactions into Expenses:<some account> but
>it's not clear how I deal with (eg) transfers to credit card account.  Some
>things I'd like to know are:
>* if I get cash out at the supermarket, should I make that two transactions
>(one to cash, one to expenses:groceries) or is this a "split"? (or doesn't
>it matter if its being automated)
>* if I import my credit card statement should those transactions be entered
>against both Expense accounts and Liabilities:Credit Card as negative
>numbers?  
>* how should I deal with checks?  ATM I am putting them into an
>Expenses:check account with the intention of transferring them to another
>account later.  
>
>Sorry if this sounds a little confused.
>
>  
>
Not "confused" exactly but I am getting the sense that you haven't yet 
grasped the fundamental concepts of "double entry bookkeeping".

There are always (at least) TWO accounts associated with a transaction, 
one on the debit side of the transaction and one on the credit side. At 
the time invented many centuries ago, negative numbers were not in 
common use, so in general you will always be entering positive amounts 
<< a negative balance for an account simply means that the net balance 
is on the opposite side* of the ledger than normal for that account.

a) If you get cash back when paying at the supermarket, yes that would 
be a split transaction. You didn't say HOW you were paying:
    If by credit card, that would be a credit to (Liabilities) Credit 
Card and debits to (Expenses) Food and (Assets) Cash.
b) Your individual credit card transactions would all be credits to 
Credit Card and debits to the appropriate expense. In neither case would 
these be negative numbers, just on opposite sides of the transaction.
c) Checks would be a credits to (assets) Checking and debits to the 
appropriate expense account.

Try the tutorial on the basics of double entry bookkeeping. If that 
isn't enough, get out a regular "bookkeeping 101" book.

Michael


* Ledger paper was originally ruled with a left (debit) and a right 
(credit) side of the page. The terms "debit" and "credit" are derived 
from Latin, he owes and he trusts (ie: I owe him).


More information about the gnucash-user mailing list