An intelligent expense tracking application that automatically fetches banking transactions, categorizes them using AI, and syncs them to Google Sheets. Built with Python, PostgreSQL, Plaid API, and Gemini API.
- Automatic Transaction Fetching: Integrates with Plaid API to automatically fetch banking transactions
- AI-Powered Categorization: Uses Google's Gemini AI to categorize transactions with 90% accuracy across 10+ spending categories
- Real-time Database Storage: Stores all transactions in PostgreSQL for fast queries and analysis
- Google Sheets Integration: Automatically syncs categorized transactions to Google Sheets for easy viewing and analysis
- Efficient Pipeline: Reduces manual financial tracking time by 80%
- Python: Core application logic
- PostgreSQL: Transaction storage and data persistence
- Plaid API: Banking transaction data fetching
- Gemini API: AI-powered transaction categorization
- Google Sheets API: Data synchronization and visualization
- Pydantic: Data validation and settings management
- SQLAlchemy: Database ORM
- Python 3.8+
- PostgreSQL database
- Plaid account with API credentials
- Google Cloud project with Gemini API enabled
- Google Cloud project with Sheets API enabled
-
Clone the repository (if applicable) or navigate to the project directory:
cd Spend-Smart -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env
Edit
.envand fill in your credentials:DATABASE_URL: PostgreSQL connection stringPLAID_CLIENT_IDandPLAID_SECRET: From Plaid dashboardGEMINI_API_KEY: From Google Cloud ConsoleGOOGLE_SHEETS_SPREADSHEET_ID: Your Google Sheets spreadsheet IDGOOGLE_SHEETS_CREDENTIALS_FILE: Path to your OAuth credentials JSON file
-
Set up PostgreSQL database:
createdb spendsmart # Or use your preferred PostgreSQL client -
Set up Google Sheets API credentials:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google Sheets API
- Create OAuth 2.0 credentials (Desktop app)
- Download credentials JSON file and save as
credentials.jsonin the project root
-
Get Plaid Access Token:
- Use Plaid Link to connect your bank account
- Exchange the public token for an access token
- You'll need to pass this access token when running the application
Run the main application with your Plaid access token:
python main.py <your_plaid_access_token>The application will:
- Fetch transactions from Plaid (last 30 days by default)
- Categorize them using Gemini AI
- Store them in PostgreSQL
- Sync to Google Sheets