This is a Streamlit web application for tracking shared expenses between myself (Ellen) and my partner (Alex). The app connects to Google Sheets for data storage and provides an interface for viewing balances, transactions, and adding new expenses.
- 💰 Balance Overview: See who owes whom at a glance
- 📊 Transaction History: View and filter past expenses
- 💵 Add Expenses: Quickly log new shared expenses
- Python 3.13
- A Google account
- A Google Cloud Platform project with Google Sheets API enabled
Create a new Google Sheet with the following columns:
| Column Name | Data Type | Description |
|---|---|---|
| Date | Date | Format: DD/MM/YYYY |
| Description | Text | Description of the expense |
| Value | Number | Amount spent (e.g., 25.50) |
| Paid by | Text | Who paid (Ellen or Alex) |
| Paid for | Text | Who the expense was for (Ellen, Alex, or Both) |
- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Enable the Google Sheets API for your project
- Create a Service Account:
- Go to "IAM & Admin" → "Service Accounts"
- Create a new service account
- Download the JSON key file
- Share your Google Sheet with the service account email (found in the JSON file under
client_email)
Create a file at .streamlit/secrets.toml with your Google Sheets credentials:
[connections.gsheets]
spreadsheet = "YOUR_GOOGLE_SHEETS_URL"
# From your JSON key file
type = "service_account"
project_id = "your-project-id"
private_key_id = "your-private-key-id"
private_key = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
client_email = "your-service-account@your-project.iam.gserviceaccount.com"
client_id = "your-client-id"
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://oauth2.googleapis.com/token"
auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
client_x509_cert_url = "your-cert-url"Note: The .streamlit/secrets.toml file is gitignored to keep your credentials secure.
Another note: More detailed instructions can be found in the Streamlit docs!
If you don't have poetry yet, first brew install:
brew install poetryAfter which you can run:
poetry installpoetry run streamlit run expenses.pyThe app will open in your default browser at http://localhost:8501
- View the current balance between Ellen and Alex
- See who owes whom and the total amount
- Browse all recorded transactions
- Filter by who paid and who the expense was for
- Log a new expense with:
- Description (e.g., "Cinema tickets")
- Amount
- Who paid
- Who the expense was for (Both, Ellen, or Alex)
expenses/
├── expenses.py # Main app entry point
├── pages/
│ ├── balance.py # Balance overview page
│ ├── transactions.py # Transaction history page
│ └── add_expense.py # Add new expense page
├── utils/
│ ├── sheets.py # Google Sheets connection
│ ├── debt.py # Balance calculation logic
│ └── transactions.py # Transaction filtering logic
├── .streamlit/
│ └── secrets.toml # Configuration (not in git)
└── pyproject.toml # Project dependencies
The app calculates the balance by:
- Summing what each person has paid
- Calculating what each person has spent (including half of "Both" expenses)
- Computing the difference to determine who owes whom
Never commit your .streamlit/secrets.toml file to version control. It contains sensitive credentials and is already included in .gitignore.