Skip to main content

Reports from GnuCash to Excel

Project description

Sorry for my English!

Python library for get reports from GnuCash to excel.

Connect directly to GnuCash book (xml or sql) and use Pandas for calculation reports. No cycles for calculation, less errors, less code.

Install

If you not programmer and want get reports:

  1. Install Python version 3 (version 2 must work, but I don’t check)

  2. Install Pandas, by typing [1]

    pip install pandas
  3. Install gnucashreport:

    pip install gnucashreport

Now, you may use cli tool gcreport

Simple command line tool

Library contain the simple cli tool, usage:

gcreport gnucash_file xlsx_file [--open_if_lock]
gnucash_file

Your gnucash database file

xlsx_file

Path to xlsx file for saving reports

Examples

>>> import gnucashreport
>>> gcrep = gnucashreport.GNUCashReport()

open sql book

>>> gcrep.open_book_sql('v:/gnucash-base/sqlite/GnuCash-base.gnucash', open_if_lock=True)

save all splits to Excel (with account name, decription, currency mnemonic and other)

>>> from gnucashreport.utils import dataframe_to_excel
>>> dataframe_to_excel(gcrep.df_splits, 'v:/tables/splits.xlsx')

Save reports by years in xlsx file:

This report contain:

  • Income, expense, profit, assets, loans, equity by months each year (sheet on each year)

  • Income, expense, profit, assets, loans, equity by years on each full year

  • Inflation (annual expenditure growth)

  • Some charts

>>> gcrep.all_reports_excel('v:/tables/ex-test.xlsx', glevel=1)

Explain glevel

glevel - how group accounts by levels: array of levels or single int level

Examples:

Accounts structure:

account levels

0

1

2

Assets:

Current assets:

Cash

Assets:

Current assets:

Card

Assets:

Reserve:

Deposite

Assets:

Reserve:

Cash

Example 1:

glevel=[0, 1]

Group accounts for 0 and 1 level, into 2 rows and 2 columns (Multiindex dataframe):

0

1

Assets

Current assets

Reserve

Example 2:

glevel=1

Groups only 1 level, into 2 rows and 1 column:

1

Current assets

Reserve

Testing

All my testing data is real. Then all testing function use external folder. For create test data, save sql book file and xml book file into any folder. Use the same data for sql and xml. Create empty folder for test data. Set this options in src/test/basetest.py

bookfile_sql = your_sql_base
bookfile_xml = your_xml_base
dir_testdata = folder_for_test_data

Run the script src/test/savetestdata.py. Run only on working branch version!

Now you may run tests.

setup.py test

license

GNU GPL 3

author

Partizand

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnucashreport-0.1.0.tar.gz (26.8 kB view hashes)

Uploaded Source

Built Distributions

gnucashreport-0.1.0-py3.5.egg (58.0 kB view hashes)

Uploaded Source

gnucashreport-0.1.0-py2.py3-none-any.whl (31.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page