NAME

tiller2qif

Finance::Tiller2QIF

DESCRIPTION

Convert Tiller CSV exports to QIF for import into Financial software like GnuCash, KMyMoney, Quicken, HomeBank, Money Manager Ex and many others.

SYNOPSIS

# Command-line
tiller2qif run --input export.csv --db tiller.sqlite3 \
               --output import.qif [--mapfile mapping.txt]

# Programmatic — see PROGRAMMATIC USE below
use Finance::Tiller2QIF;

Finance::Tiller2QIF::run(
  input   => 'export.csv',
  db_path => 'tiller.sqlite3',
  mapfile => 'mapping.txt',
  output  => 'import.qif',
);

OVERVIEW

Tiller Money (tillerapp.com) aggregates bank and credit-card transactions into a Google Sheet and lets you export a CSV. This module ingests that CSV into a SQLite database, optionally applies a category-mapping file to translate Tiller's auto-assigned categories to match your accounts/categories, then emits a QIF file ready for import.

The three phases can be run individually or together:

INSTALLATION

From CPAN

cpan Finance::Tiller2QIF
# or
cpanm Finance::Tiller2QIF

Perl Dependencies

Runtime: Cpanel::JSON::XS, DateTime::Format::Flexible, Getopt::Long::Descriptive, Path::Tiny, Mojo::SQLite, Text::CSV

Testing: Capture::Tiny, Test2::V0, Test2::Bundle::More, Test2::Tools::Exception

On Debian/Ubuntu:

All of Tiller2QIF’s dependencies are available through package management if you need to install to system Perl.

sudo apt install libpath-tiny-perl libtext-csv-perl libtest2-suite-perl libcapture-tiny-perl \
  libmojo-sqlite-perl libcpanel-json-xs-perl libdatetime-format-flexible-perl
sudo cpan install Finance::Tiller2QIF

On Windows

tiller2qif works with Strawberry Perl, after installing Strawberry Perl, install from CPAN.

CLI COMMANDS

OPTIONS

  "input":    "~/Downloads/mytillerdump.csv",
  "output":   "/tmp/tillerout.qif",
  "db":       "~/.data/tiller2qif.sqlite3",
  "mapfile": "~/.config/tiller.mapping"
}

Pass the config file with --config. Command-line options override config file values.

MAPPING FILE

The mapping file controls how Tiller categories are translated into destination account or category names and which transactions to suppress. Each non-comment line has the form:

[AccountFilter] field | pattern | destination

Lines beginning with # and blank lines are ignored. Rules are evaluated in order; the first matching rule wins and no further rules are checked for that transaction.

For double-entry programs such as GnuCash, destination is a full account name (e.g. Expenses:Groceries). For single-entry programs such as Quicken it is a category name.

The optional default line sets the fallback for transactions that match no rule. It must appear as the last non-comment line:

default | source

If the default line is omitted, unmatched transactions behave as default | source.

EXAMPLES

Advanced Use

You can write SQL scripts or use an interactive sqlite3 client to make changes between steps. For example your Tiller sheet might have an account "Checking", while your table of accounts has "Assets::Current Assets::Bank::Checking". Custom SQL you keep the short name in Tiller even though mapping rules can't rename accounts.

The --beforemap and --aftermap options allow SQL scripts to run immediately before and after the map phase without having to break the workflow into separate commands. This is the preferred way to preprocess or post-process transactions when using run or map as a single step.

While other CSV export sources are not directly supported, you can write a script to remap the fields for ingestion or just import into the table, and then use the map and emit stages to complete your export. If translating other CSV sources be aware that Tiller currently only provides it's data in the US 'MM/DD/YYYY' format, this program can also accept dates in ISO 8601 'YYYY-MM-DD'. Data is written into the SQLite database using the ISO 8601 format.

PROGRAMMATIC USE

Finance::Tiller2QIF is primarily a CLI tool; the public functions exist to support the command dispatcher. Programmatic users will likely use this module as a starting point and call the sub-modules directly (Finance::Tiller2QIF::ReadCSV, Finance::Tiller2QIF::Map, Finance::Tiller2QIF::WriteQIF) for finer control.

Note that all functions accept db_path as the database parameter. The CLI normalises the --db option to db_path internally; programmatic callers should use db_path directly.

run

Finance::Tiller2QIF::run(
  input     => 'export.csv',
  db_path   => 'tiller.sqlite3',
  mapfile   => 'mapping.txt',     # optional
  beforemap => 'pre.sql',         # optional
  aftermap  => 'post.sql',        # optional
  output    => 'import.qif',
);

Convenience wrapper that calls ingest, apply_map, and emit in sequence with the same options hash.

ingest

Finance::Tiller2QIF::ingest( input => 'export.csv', db_path => 'tiller.sqlite3' );

Parses the Tiller CSV export and loads rows into the SQLite database. Returns the number of new rows inserted.

apply_map

Finance::Tiller2QIF::apply_map(
  db_path   => 'tiller.sqlite3',
  mapfile   => 'mapping.txt',  # optional
  beforemap => 'pre.sql',      # optional — runs before map rules
  aftermap  => 'post.sql',     # optional — runs after map rules
);

Applies category mapping rules to unexported transactions. If mapfile is omitted, transactions pass through unchanged. beforemap and aftermap are paths to SQL scripts executed immediately before and after the mapping phase respectively; each may contain multiple semicolon-terminated statements.

emit

Finance::Tiller2QIF::emit( db_path => 'tiller.sqlite3', output => 'import.qif' );

Writes unexported transactions from the database to a QIF file and marks them as exported.

AUTHOR

John Karr brainbuz@cpan.org

LICENSE

GPL version 3 or later.