How to use the command gnucash-cli (with examples)
Gnucash-cli is a command-line version of GnuCash, a personal and small business accounting software. Gnucash-cli provides a command-line interface to access and manipulate GnuCash data files. It offers various functionalities, such as getting quotes for currencies and stocks and generating financial reports.
Use case 1: Get quotes for currencies and stocks specified in a file and print them
Code:
gnucash-cli --quotes get path/to/file.gnucash
Motivation
Getting quotes for currencies and stocks is useful for tracking the performance and value of various financial instruments. By using gnucash-cli to retrieve these quotes, users can have an up-to-date understanding of their investments and make informed decisions.
Explanation
--quotes get
: This argument specifies that the command should retrieve quotes for currencies and stocks.path/to/file.gnucash
: This argument specifies the path to the GnuCash data file from which the quotes should be retrieved.
Example output
Currency quotes:
- USD: 1.00
- EUR: 0.85
- GBP: 0.73
Stock quotes:
- AAPL: $150.24
- GOOGL: $2505.36
- TSLA: $680.98
Use case 2: Generate a financial report of a specific type, specified by --name
Code:
gnucash-cli --report run --name "Balance Sheet" path/to/file.gnucash
Motivation
Generating financial reports is essential for understanding the financial position of a business or individual. By using gnucash-cli to generate specific types of financial reports, users can analyze and assess their financial health effectively.
Explanation
--report run
: This argument indicates that the command should run a financial report.--name "Balance Sheet"
: This argument specifies the type of financial report to be generated, in this case, a “Balance Sheet”.path/to/file.gnucash
: This argument denotes the path to the GnuCash data file from which the financial report should be generated.
Example output
Balance Sheet Report:
ASSETS:
- Current Assets: $25,000.00
- Fixed Assets: $100,000.00
LIABILITIES:
- Current Liabilities: $30,000.00
- Long-Term Liabilities: $70,000.00
EQUITY:
- Opening Balances: $50,000.00
- Retained Earnings: $75,000.00
Conclusion
Gnucash-cli is a powerful command-line tool that provides convenient access to GnuCash functionalities. It allows users to retrieve quotes for currencies and stocks and generate financial reports, enabling effective financial management and analysis. By leveraging gnucash-cli, users can save time and streamline their financial operations.