|
1 | | -# splitwise-export-receipts |
| 1 | +# Splitwise Export Receipts |
| 2 | + |
| 3 | +A user-friendly tool to export all your Splitwise transaction data—including any/all receipts—into a single spreadsheet (CSV/XLSX). Designed for both technical and non-technical users. |
| 4 | + |
| 5 | +## Features |
| 6 | +- Export all expenses (optionally by group/date) |
| 7 | +- Download and link all available receipts |
| 8 | +- Output a single spreadsheet with all relevant data and clickable receipt links |
| 9 | +- Easy-to-use CLI |
| 10 | +- Cross-platform (Windows, Mac, Linux) |
| 11 | + |
| 12 | +## 🚨 Splitwise API Setup (Required Before First Use) |
| 13 | + |
| 14 | +> **Note** |
| 15 | +> You must create a Splitwise app to obtain your API keys before using this tool. This is a one-time setup required by Splitwise for all third-party tools. |
| 16 | +> |
| 17 | +> **Steps:** |
| 18 | +> 1. Go to [https://secure.splitwise.com/apps/new](https://secure.splitwise.com/apps/new) and create a new app. |
| 19 | +> 2. Set the callback URL to anything (e.g., `http://localhost:8080`). |
| 20 | +> 3. After creating the app, copy your **Consumer Key** and **Consumer Secret**. |
| 21 | +> 4. When you run this tool for the first time, you will be prompted to enter these keys and complete the authorization process in your browser. |
| 22 | +> 5. Your credentials will be saved securely in `~/.splitwise_auth.json` for future use. |
| 23 | +
|
| 24 | +## ⚡ How to Use (Step-by-Step Flow) |
| 25 | + |
| 26 | +1. **Install dependencies** (in a virtual environment): |
| 27 | + ```bash |
| 28 | + python3 -m venv .venv |
| 29 | + source .venv/bin/activate |
| 30 | + python -m pip install --upgrade pip |
| 31 | + python3 -m pip install -r requirements-lock.txt |
| 32 | + ``` |
| 33 | + > **Note:** |
| 34 | + > - For reproducible installs, use `requirements-lock.txt` (recommended for most users). |
| 35 | + > - `requirements.txt` contains version ranges and is intended for development or as a reference. |
| 36 | +2. **Run the tool:** |
| 37 | + ```bash |
| 38 | + python src/splitwise_export_receipts.py |
| 39 | + ``` |
| 40 | +3. **Authenticate with Splitwise:** |
| 41 | + - Enter your Consumer Key and Secret when prompted. |
| 42 | + - Open the provided authorization URL in your browser. |
| 43 | + - **After authorizing, you will see a browser error (page not found).** |
| 44 | + |
| 45 | +> **Important: Getting the OAuth Verifier** |
| 46 | +> - This is expected! Splitwise will redirect you to your callback URL (e.g., `http://localhost:8080`) and the page will not load. |
| 47 | +> - **Look at the URL in your browser's address bar.** |
| 48 | +> - Find the part that says `oauth_verifier=...` and copy the value after the `=`. |
| 49 | +> - Paste this value into the terminal when prompted for the verification code. |
| 50 | +
|
| 51 | +> _Example:_ |
| 52 | +> ``` |
| 53 | +> http://localhost:8080/?oauth_token=...&oauth_verifier=YOUR_CODE_HERE |
| 54 | +> ``` |
| 55 | +> Copy `YOUR_CODE_HERE` and paste it into the script prompt. |
| 56 | +
|
| 57 | +4. **Choose output options:** |
| 58 | + - The script will prompt you for the output file path (default: `splitwise_export.csv`). |
| 59 | + - You can choose `.csv` (recommended) or `.xlsx`. |
| 60 | + - You can also specify the receipts directory (default: `receipts`). |
| 61 | +
|
| 62 | +5. **Open your exported spreadsheet:** |
| 63 | + - For CSV: Open in Excel or Google Sheets. The `Receipt` column contains a clickable link for each transaction with a receipt. Click "View Receipt" to open the local file (if it exists on your machine). |
| 64 | + - For XLSX: The `Receipt` column contains the local file path. |
| 65 | +
|
| 66 | +6. **Receipts are saved in the specified directory.** |
| 67 | +
|
| 68 | +## 📂 Specifying Output Locations |
| 69 | +
|
| 70 | +You can control where the spreadsheet and receipts are saved using command-line options: |
| 71 | +
|
| 72 | +- **Spreadsheet output file:** |
| 73 | + - Use `--output` (or `-o`) to set the spreadsheet file path: |
| 74 | + ```bash |
| 75 | + python src/splitwise_export_receipts.py --output /path/to/your/spreadsheet.csv |
| 76 | + ``` |
| 77 | + - Example: |
| 78 | + ```bash |
| 79 | + python src/splitwise_export_receipts.py --output ~/Desktop/splitwise_export.csv |
| 80 | + ``` |
| 81 | +
|
| 82 | +- **Receipts directory:** |
| 83 | + - Use `--receipts-dir` to set the receipts folder: |
| 84 | + ```bash |
| 85 | + python src/splitwise_export_receipts.py --receipts-dir /path/to/receipts_folder |
| 86 | + ``` |
| 87 | + - Example: |
| 88 | + ```bash |
| 89 | + python src/splitwise_export_receipts.py --receipts-dir ~/Desktop/splitwise_receipts |
| 90 | + ``` |
| 91 | +
|
| 92 | +- **Combine both:** |
| 93 | + ```bash |
| 94 | + python src/splitwise_export_receipts.py --output ~/Desktop/splitwise_export.csv --receipts-dir ~/Desktop/splitwise_receipts |
| 95 | + ``` |
| 96 | +
|
| 97 | +- **If you don't specify these options:** |
| 98 | + - The script will prompt you for the output file path (default: `splitwise_export.csv` in the current directory). |
| 99 | + - Receipts will be saved in the `receipts` folder in your current directory by default. |
| 100 | + |
| 101 | +- **See all options:** |
| 102 | + ```bash |
| 103 | + python src/splitwise_export_receipts.py --help |
| 104 | + ``` |
| 105 | + |
| 106 | +## Troubleshooting |
| 107 | +- If you see a browser error after authorizing Splitwise, this is normal. Just copy the `oauth_verifier` from the URL as described above. |
| 108 | +- If you get a `ModuleNotFoundError`, make sure you installed all dependencies in your virtual environment. |
| 109 | +- If the receipt links do not work, make sure the receipt files are present at the specified paths on your computer. |
| 110 | + |
| 111 | +## Requirements |
| 112 | +- Python 3.10+ |
| 113 | +- Splitwise account (you will need to create an API app for OAuth) |
| 114 | + |
| 115 | +## Roadmap |
| 116 | +- [x] Splitwise API authentication |
| 117 | +- [x] Expense fetching |
| 118 | +- [x] Receipt downloading |
| 119 | +- [x] Data export to spreadsheet |
| 120 | +- [x] CLI improvements |
| 121 | +- [x] Documentation |
| 122 | + |
| 123 | +## License |
| 124 | +MIT |
0 commit comments