kevinschaich / mintable
- вторник, 29 января 2019 г. в 00:19:00
JavaScript
Roll-your own Mint clone for managing personal finances using the Google Sheets and Plaid APIs.
Roll-your-own Mint clone for managing personal finances using the Google Sheets and Plaid APIs.
Mintable allows you to automatically populate transactional data from your financial institutions into a Google Sheet for analysis and visualization. Here's how it works:
All this repo does is talk to Plaid/Google APIs and write tokens to your local file system. If you don't feel safe entering real bank credentials, you can audit the code yourself and try it on Plaid's sandbox environment.
.env.sample
to .env
. Variables in this file will be loaded as environment variables. This file is ignored by Git.npm install
in the repo root..env
:
PLAID_CLIENT_ID
PLAID_SECRET
PLAID_PUBLIC_KEY
npm run token-plaid <account>
where account
is an id for the bank you want to connect (it's for your personal reference, so you can name it anything)..env
. This process needs to be repeated for each bank you want to connect. Make sure to run each with a different account
name.npm run test-plaid
now should log the recent transactions in your connected accounts..env
as SHEETS_SHEET_ID
. You can find this in the spreadsheet URL as https://docs.google.com/spreadsheets/d/<ID>/edit
..env
:
SHEETS_CLIENT_ID
SHEETS_CLIENT_SECRET
SHEETS_REDIRECT_URI
(use the first item in redirect_uri
)npm run token-sheets
. This will prompt for auth and save the token in .env
.npm run test-sheets
should fill cell A1 in your sheet with "It worked!".node index.js
in the repo root. If everything works, your spreadsheet should have been updated.Note: The logic for transforming raw Plaid transactions to Google Sheets cell data is defined in
index.js
– helpers can be found in thelib
folder.
Out of the box, Mintable will populate a very basic list of transactions. Since the Google Sheets APIs are cumbersome to interact with for manipulating cell data and formatting, I recommend that you create a "template" sheet as a base. Mintable will only touch the few spreadsheet columns it needs to update transactional data (defined in index.js
), so the right side of your spreadsheet be as complex as you like and contain all the calculations, formulas, and visualizations you want to see for each month's data. You can create your own template or start with this premade one with some useful formulas:
To use this as your monthly template sheet:
2018.12
sheet in the template, then Copy To..., and select your Mintable spreadsheet when Google asks where you want to copy to.Constants
sheet.Copy of 2018.12
sheet to <YEAR>.<LAST MONTH>
. For example, if the current date is February 1, 2019, change the name of the first sheet to 2019.01
.Copy of Constants
sheet to Constants
.node index.js
from the repo root. If everything works, your spreadsheet should have been updated with calculations intact! You may need to fix any broken formula references that got messed up in the copy process.The repo contains a CircleCI config file which runs the update every day at 5AM UTC (midnight US Eastern time). You can adjust the cron config to tweak the time/frequency of the updates. Note that your local .env
is not checked into the repo, so you will need to copy all those env variables into your CircleCI project settings.
This is totally optional if you don't trust CI with your tokens. Just run it manually when you want to update things.
Mintable started out as a fork of Evan You's build-your-own-mint skeleton. Evan put together a great set of scripts to make the connection between Plaid and Google Sheets painless.
This repo is a lot more opinionated about defaults and gives you a working transaction spreadsheet out of the box. If you're looking for something more bare-bones, try build-your-own-mint.