LinuxCommandLibrary

gnucash-cli

Process GnuCash data from the command line

TLDR

Get quotes for currencies and stocks specified in a file and print them

$ gnucash-cli [[-Q|--quotes]] get [path/to/file.gnucash]
copy

Generate a financial report of a specific type, specified by --name
$ gnucash-cli --report run --name "[Balance Sheet]" [path/to/file.gnucash]
copy

SYNOPSIS

gnucash-cli [options]

PARAMETERS

--version
    Display the version number and exit.

--help
    Display help message and exit.

--import
    Import data from the specified file. Requires specifying the data format (e.g., --import --import-format ofx).

--import-format
    Specify the format of the import file (e.g., ofx, qif, csv).

--export
    Export data to the specified file.

--report
    Run the specified report.

--run
    Run a GnuCash scheme command.


    The GnuCash file to open.

DESCRIPTION

The gnucash-cli command provides a non-GUI interface to access and manipulate GnuCash accounting files. This allows for scripting and automation of common tasks such as importing data, running reports, and performing other accounting functions without needing the full graphical GnuCash application. It's particularly useful for server-side processing, batch jobs, and integration with other data sources.

The command supports a range of operations including importing data from various formats (e.g., OFX, QIF, CSV), exporting data, running pre-defined reports, querying account balances, and executing simple transactions. It offers a powerful, flexible, and efficient way to interact with GnuCash data in an automated fashion.

gnucash-cli is a crucial tool for users who need to process accounting data without manual interaction, enabling streamlined workflows and improved data integration.

CAVEATS

The functionality of gnucash-cli is dependent on the underlying GnuCash libraries. Ensure the correct versions are installed to avoid compatibility issues.
Scripting requires understanding of GnuCash's data structure and reporting capabilities.

EXAMPLES

1. Import an OFX file:
gnucash-cli --import mybank.ofx --import-format ofx mydata.gnucash

2. Run a report:
gnucash-cli --report "Profit & Loss" mydata.gnucash

3. Get account balance:
gnucash-cli --run '(use-modules (gnucash)) (display (account-get-balance (account-lookup-by-name "Checking Account" #f)))' mydata.gnucash

HISTORY

gnucash-cli was developed as a companion tool to the GnuCash accounting software to provide command-line access to its features.
Its development has been driven by the need for automated data processing, reporting, and integration with other systems. Over time, it has evolved to support various data formats and offer enhanced scripting capabilities.

SEE ALSO

gnucash(1)

Copied to clipboard