The code automates the process of importing transactions from Splitwise into your YNAB budget.By following instructions below, you can automate to run it daily using Github Actions. So, your Splitwise transactions will be imported everyday just like your other automated accounts.
You would need to create a new account named 'Splitwise' in your YNAB accounts(mentioned below in Setup #1). That is the only necessity for this repo.
That said, I would to mention my workflow:
- In addition to a 'Splitwise' account, I also create a 'Splitwise' category. I place this in a 'Don't count' group as it helps in the reports.
- Expenses paid by me: I split the expense between a category corrsponding to the expense and the 'Splitwise' category.
- Expenses paid by others: I add my share as an expense under 'Splitwise' account and the corresponding category.
The code imports all the transactions for which you owe money.
Yes. Since you will be deploying your own Github Actions to deploy, you will be using just around 15 minutes from the free 2000 minutes per month.
This repo moves transactions from Splitwise to YNAB.
-
Go to your YNAB budget (YNAB) and create a new account named
Splitwise
. This is where the imported transactions will flow into. -
Collect Credentials from YNAB and Splitwise:
a. YNAB:
- Go to YNAB Developer Settings
- Create a new
Personal Access Token
. - You will see the token at the top of page, save that in a safe place as you won't be able to access it again.
b. Splitwise:
- Go to Splitwise Apps
- Click on
Register your application
- Fill
application name
(YNAB_Splitwise_sync),description
andHomepage URL
(http://api-example.splitwise.com/) and click onRegister and API key
- Copy
Consumer Key
,Consumer Secret
andAPI keys
.
-
Fork this repo. (by clicking on the 'Fork' option on the top of this page.)
-
Add the Credentials on Github Actions:
- Go to the
Settings
tab, thenSecrets and variables
>Actions
- Under
Secrets
tab, usingNew repository secret
, you need to add 4 Name-Secret pairs:- Name:
YNAB_PERSONAL_ACCESS_TOKEN
, Secret:Personal Access Token
from 2a. - Name:
SW_API_KEY
, Secret:API keys
from 2b. - Name:
SW_CONSUMER_KEY
, Secret:Consumer Key
from 2b. - Name:
SW_CONSUMER_SECRET
, Secret:Consumer Secret
from 2b.
- Name:
- Similarly, Under
Variables
tab, usingNew repository variable
, add:- Name:
YNAB_BUDGET_NAME
, Value: your YNAB budget name (check your YNAB app or website, if you don't know, fill 'My Budget') - Name:
YNAB_ACCOUNT_NAME
, Value: 'Splitwise' (created in step 1).
- Name:
- Go to the
The Github Actions now triggers this code repo at 12:00 UTC
everyday and transfers previous day's transactions from Splitwise to YNAB.
If you would like to change the schedule time, change the cron expression in python-app.yaml file.
- Apr 6, 2024: fixed the
UnboundLocalError: local variable 'paid' referenced before assignment
error.
-
On your forked repo, you would see something like
This branch is X commits behind amit-hm/splitwise_yanb_sync:main
. -
Click on
Sync fork
. -
Click on
Update branch
.This should update your forked repo to this repo and hence bring in those new bugfixes or features.
Github Actions, unfortunately, deactivates after 60 days of inactivity. So, you might have to manually enable the workflow again every 60 days.
Contact me at [email protected]