This package provides a simple interface for reading Quicken For Mac databases. It inlcudes both a python module and a command line interface.
Quicken For Mac keeps its user files in ~/Library/Application Support/Quicken
.
In that directory the database file is in Documents/Qdata.quicken/data
(or thereabouts).
For safety, do not operate directly on this file. Make a copy as, for example: ::
copyofqdata: SQLite 3.x database, last written using SQLite version 3036000
The output of the last command verifies that the file is an sqlite
database.
The command line tool, also called qquery
, provides a simple, convenient interface to the database.
It offers many options, all of which are described with the --help switch: ::
Here are some examples.
List all accounts: ::
List all categories: ::
List all transactions (this can create a lot of output): ::
List only transations from account "First National", category "Charity", posted during the year 2016: ::
--restrict-to-accounts="First National" \
--restrict-to-categories="Charity" \
--date-from=2016-01-01 --date-to=2016-12-31
Report on the balances (including details of secuities) of all accounts as of December 31, 2016. (Accounts with zero balance will not be listed): ::
The module may be included in python programs in the the usual way. Help is also available. Use the following to get a list of all available functions: ::
import qquery help (qquery)
Here is how to list all accounts using the iterator provided by the function getAccounts()
.
Each pass through the loop returns a dictionary for each account: ::
import qquery as qq qq.open ('copyofqdata') for account in qq.getAccounts(): ... print account ...
Similarly, this is how to list all categories by using the iterator provided by the function
getCategories()
.
Each pass through the loop returns a dictionary for each category: ::
import qquery as qq qq.open ('copyofqdata') for category in qq.getCategories(): ... print category ...
And for all transactions using getTransactions()
: ::
import qquery as qq qq.open ('copyofqdata') for trans in qq.getTransactions(): ... print trans ...
There are many fields supplied with each trans
dictionary, so the above will produce
a lot of output. One may instead choose to examine only some of those fields as in ::
import qquery as qq qq.open ('copyofqdata') for trans in qq.getTransactions(): ... print trans['date'], trans['amount'], trans['payeeName'] ...
This can be further refined using the setRestrictTo functions, for example: ::
import qquery as qq qq.open ('copyofqdata') qq.setRestrictToAccounts ('First National') qq.setRestrictToCategories ('Charity,Gifts') qq.setRestrictToDates (dateFrom='2016-01-01', dateTo='2016-12-31') for trans in qq.getTransactions(): ... print trans['date'], trans['amount'], trans['payeeName'] ...
This is a lot more information in the Quicken database than is exposed through this interface. Requests for feature enhancements are welcome.