Skip to content

An AI-driven tool for managing multi-currency expenses, integrating multiple accounts with Google Sheets using Vertex AI Gemini Pro for real-time transaction tracking and categorization.

Notifications You must be signed in to change notification settings

BabakBar/AutoSpendTracker

Repository files navigation

Smart Auto Spend Tracker!

Intro

happy to share this project that made my life in Mexico simpler and more fun. moving from europe, i found myself spending across different currencies – day-to-day costs in MXN Peso, some in EURO, and subscriptions in Dollars. It was a nice opportunity to blend some Python, Cloud, and power of AI to craft a auto-spending tracker.

Project Overview

This is a tool i built to track, categorize, and monitor my spending from multiple accounts, starting with Wise & PayPal, which I use the most. It utilizes Google Vertex AI 'Gemini Pro' to process and analyze my transaction data.

Overall, this is how the entire project works.

Workflow

Features

  • Multi-Currency/Language Support: Seamlessly handles MXN, EUR, USD / English, German.
  • Automated Tracking: Integrates with email notifications for transaction alerts.
  • Intelligent Categorization: Leverages AI to categorize & structure expenses.
  • Google Sheets Integration: Presents a neat summary of expenses with details.
  • Open Source: Shared with the community to inspire and innovate together.

How It Works

  1. Transaction Notification: As soon as I use Wise or PayPal at any moment, they notify me by sending an email and the new entry will added to my google sheet in the background. This entry includes date, time, merchant, amount, currency, account and category generated by AI - all in real time. What kicks this whole thing off is an email.

with each transaction a new entry is added!

Output

Rather than giving all bank credentials to other apps, I set my banks to email me for a transaction above the minimum limit!

  1. Function Trigger: The Gmail API listens for new emails and triggers a parsing function.
  2. Prompting Gemini Pro: The prompt is where magic happens! For this project that beauty is in turning any transaction details into useful data. For my use case, PayPal emails are in German, and Wise is in English, so I had to configure the model about this. So I went through several iterations for the prompt. But it still keeps growing.

I could give some sample output of what I would like the JSON to resemble, and then explain the details of the schema. It is amazing how just a few sentences and one example of what I wanted was enough for Gemini to understand my intention toward it and my expectations of the structure of the output. Finally, Gemini Pro enriches the transaction data and gives a category to the expenditure, and we get something like parsed transaction data:

{
'amount': '335', 
'currency': 'MXN', 
'merchant': 'Uber Eats', 
'category': 'Food & Dining', 
'date': '08-02-2024', 
'time': '20:25 PM', 
'account': 'Wise'
}

This is remarkable to have nice formatted info of all the details.

  1. Google Sheets Update: The sheet.gs file attached is the app script for the Google sheet (it can be enabled from extensions in sheets) to apply a custom font/size for new entries. The ultimate data is automatically updated in Google Sheets for easy tracking and analysis.

Contact

This took me 3 weekends to figure out and setup, hopefully with this code you can make it work in even less time! If you're curious about the project, want to contribute, or just say 'hola', feel free to reach out!

About

An AI-driven tool for managing multi-currency expenses, integrating multiple accounts with Google Sheets using Vertex AI Gemini Pro for real-time transaction tracking and categorization.

Resources

Stars

Watchers

Forks