Tool for syncing bank transaction data to Google Sheets with Plaid.
Project description
GSheets-Plaid
A spring break project to get my bank transaction data in Google Sheets without using Google Apps Script.
gsheets-plaid
is a tool for getting your raw bank transaction data into a Google Sheets spreadsheet, to enable you to make your own formulas and charts for tracking spending, making goals, etc. This app is 100% free (assuming you don't already have a bunch of Google Cloud projects), but there is a bit of one-time setting up to do to get your Google and Plaid credentials in place. This README contains all the instructions to get you from a fresh install of the package to bank transactions in a Google Sheets file.
Please open an issue if something isn't working or if the documentation isn't clear.
Usage
Prerequisites
- Python 3.10 or later
Installation
Using a virtualenv is a good idea.
python3 -m pip install gsheets-plaid
Create a Google Cloud project and enable the Google Sheets API
Follow this tutorial
Be sure to enable the "Google Sheets API"
Create access credentials for Google
Follow this tutorial for creating OAuth client ID credentials for your Google account.
- Choose "Desktop app" in the tutorial
OAuth consent screen
Before Google Cloud Platform will let you create OAuth client ID credentials, it will make you complete the OAuth consent screen. Fill out the required fields with your personal email, and choose an arbitrary application name. Since we aren't planning on publishing this app, it doesn't really matter.
On the "Scopes" step, add the following scope: https://www.googleapis.com/auth/drive.file
. You can use the search feature and look up drive.file
to quickly find the right scope.
On the "Test users" page, add the google account email that corresponds with the account you want to have the finance tracker saved on.
Back to creating OAuth credentials
Here is a summary of how to create the credentials:
- Click "Create credentials"
- Click "OAuth client ID"
- Select "Desktop app"
- Type a name of your choice
- Click the download icon (when you hover it says "Download OAuth Client")
- Save your Client ID for later, we will use it as the
GOOGLE_CLOUD_CLIENT_ID
environment variable - Click "Download JSON"
Later, we will use the OAuth credentials filepath as the GOOGLE_CLOUD_CLIENT_CONFIG
environment variable.
Create a Google service account key
Follow this tutorial for creating and downloading a service account key for the default compute service account in your Google Cloud project. Later, we will use the service account key filepath as the GOOGLE_APPLICATION_CREDENTIALS
environment variable.
Note: Service account keys are sensitive and should not be shared. See this documentation for alternative authentication strategies.
Create a Plaid Developer account
Create a Plaid developer account here.
After you have created an account, go to Team Settings > Keys. You should see your client_id
, as well as Development and Sandbox secrets. Have these keys ready to copy for later. Once you are able to get the local web server running, you will enter them there.
Register the redirect URI in the Plaid Dashboard
Add the redirect URI to the list of allowed redirect URIs in the Plaid Dashboard. By default, the redirect URI is https://localhost:8080/google-oauth-callback
.
Generate a random string for cookie signing
In order to use cookies in Flask, you must set the FLASK_SECRET_KEY
environment variable or it won't work. Since this project isn't designed to be production-ready, you can use literally any string of text, or for best practice you can run some kind of cryptographic random generator.
See this documentation for more information (including examples of how to quickly generate a cryptographically random secret key).
Link a bank account
We are finally getting to the exciting part!
If everything is configured correctly, running the following command will open a new browser tab with a small local web server you can use to connect a bank account.
GOOGLE_CLOUD_CLIENT_ID=your_google_cloud_client_id_here \
GOOGLE_CLOUD_CLIENT_CONFIG=/path/to/oauth/client/credentials/file.json \
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json \
FLASK_SECRET_KEY=super_secret_string \
python3 -m gsheets_plaid
If you are using the sandbox
environment, note that the credentials are provided at the bottom of the screen. If you are using the development
environment, use your actual bank account credentials. Note that you are only given 5 tokens to use in the development environment, but if you submit a ticket on Plaid Dashboard, you can get it bumped up to 100 tokens, which should be more than plenty for personal usage.
Once you have added all the bank accounts you want, close the browser tab and enter CTRL+C
in the terminal to kill the web server process.
That's it! Hopefully you're inspired to write some cool formulas and make neat charts using this raw transaction data.
Publishing new releases
(for maintainers)
- Tag the main branch
git tag v[insert-version-here]
- Push latest commits with tags
git push origin --tags
- Build repo
python -m build
- Upload distribution archives to PyPi
python -m twine upload dist/*
- Create new release on GitHub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gsheets-plaid-0.4.2.tar.gz
.
File metadata
- Download URL: gsheets-plaid-0.4.2.tar.gz
- Upload date:
- Size: 31.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba9046d055c845f2451b3c3ff9abc9f235e439c266d05ed101f30a90173f633 |
|
MD5 | 0189cff40fa8391f70d767c37efd5954 |
|
BLAKE2b-256 | 146b8e04158cac6aaf397cb10f2a0cfe36722369ffd5d2a7256da24c70e44a3f |
File details
Details for the file gsheets_plaid-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: gsheets_plaid-0.4.2-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 807a58f8451ec7326982ed3ec8a237221ec71a98f16cdecce1af98a2a958d6a9 |
|
MD5 | 1516ba817b8033b2f3914ebfa41d4c72 |
|
BLAKE2b-256 | b46f47711d14118bc411f80813b2ea868dfd08a7cb268c8f99488415d2fe3260 |