MoneyForward to YNAB migrator

This Ruby script downloads transaction history from Money Forward then uploads it to YNAB.

Principle

  • Use Capybara with the Cuprite driver to log into the Money Forward website and download transaction history CSV files.
  • Parse the CSV files and converts the data to a format that works with YNAB.
  • Use YNAB API Ruby library to post transactions to your YNAB budget.
  • Budget and account mappings are set in a configuration file (config.yml).

Setup

You'll need Ruby and Bundler.

# Install dependencies
bundle install

# Start a config YAML file
cp config/example.yml config/david.yml

The script currently looks for environment variables for credentials:

  • MONEYFORWARD_USERNAME
  • MONEYFORWARD_PASSWORD
  • YNAB_ACCESS_TOKEN

You can for example use envchain to manage those credentials:

envchain --set --noecho mfynab MONEYFORWARD_USERNAME MONEYFORWARD_PASSWORD YNAB_ACCESS_TOKEN

Running

To run, you'll simply need to set the environment variables. Using envchain, that'll look like this:

envchain mfynab bundle exec bin/mfynab config/david.yml

Todo

  • Force MoneyForward to sync all accounts before downloading data. (Can take a while.)
  • Use Thor to manage the CLI
  • Breakdown logic in parts