Animated data flow diagram

AI Expense Tracker Agent: Log Expenses via Chat to Google Sheets

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

OpenAI Google Sheets Langchain

Overview

Unlock Effortless Expense Tracking with this AI Agent

This AI Agent transforms how you manage expenses. Simply send a message via the n8n chat interface, like 'Groceries $25.50 yesterday' or 'Client dinner 120 EUR on 2024-03-15', and the agent takes care of the rest. It uses OpenAI's powerful language models to understand your input, extract key details (cost, description, and date), and then automatically logs this information into a designated Google Sheet. This agent acts as your personal AI accountant, available 24/7 via chat, using its 'expense logging' and 'data interpretation' abilities.

Key Features & Benefits

  • Conversational Expense Logging: Ditch cumbersome forms. Just chat naturally to record expenses using the agent's 'natural language understanding' ability.
  • AI-Powered Data Extraction: Leverages OpenAI (GPT models) for its 'information extraction' ability to accurately parse amounts, descriptions, and dates from your messages.
  • Automated Google Sheets Integration: Keeps your expense records organized and up-to-date in Google Sheets without manual entry, showcasing its 'data management' ability.
  • Langchain Agent Framework: Utilizes an AI agent with memory and tool-use capabilities for robust interaction and task execution.
  • Streamlined Workflow: Automates the entire process from chat message to structured data in your spreadsheet.
  • Time-Saving & Efficient: Significantly reduces manual effort and the chance of errors in expense tracking.
  • Customizable & Adaptable: Modify the prompts or connected services to fit your specific needs.

Use Cases

  • Solopreneurs and Founders: Quickly log business expenses on the go via chat, ensuring no receipt is missed and financial records are always current.
  • Freelancers & Consultants: Effortlessly track project-related expenses by simply sending a message, making client billing and tax preparation easier.
  • Marketing Teams (B2C E-commerce/B2B SaaS): Log campaign expenditures, software subscriptions, or team event costs discussed in internal communications directly into a shared tracker.
  • Operations Heads (B2C E-commerce/B2B SaaS): Streamline tracking of miscellaneous operational costs or reimbursements reported by team members via chat.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • OpenAI API Key.
  • Google Sheets API credentials configured in your n8n instance.
  • A Google Sheet prepared for expense tracking (a template link is provided in setup instructions).

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Set up Google Sheets:
  4. Configure the 'OpenAI Chat Model' and 'OpenAI Chat Model1' nodes with your OpenAI API Key by selecting or creating new credentials.
  5. Configure the Sub-Workflow:
    • Open the 'Parse msg and save to Sheets' node (it's a Langchain Tool that executes a workflow).
    • In the 'Workflow' parameter, click the dropdown and re-select this same workflow (its name is 'AI agent: expense tracker in Google Sheets and n8n chat'). This step is crucial for the agent to correctly call its data saving function.
  6. Ensure the 'AI Agent' node has the correct system message: "You are a helpful accountant. Use save to db tool to save expense message to DB. respond with 'Your expense saved, here is the output of save sub-workflow:[data]'". This should be pre-filled.
  7. Activate the workflow (toggle the 'Active' switch to ON in the n8n editor).
  8. Test by sending a message to the n8n chat webhook (find the URL in the 'When chat message received' trigger node after activating). For example: "car wash; 59.3 usd; 25 jan 2024".
  9. You should receive a confirmation in the chat like: "Your expense saved, here is the output of save sub-workflow:{"cost":59.3,"descr":"car wash","date":"2024-01-25","msg":"car wash; 59.3 usd; 25 jan 2024"}", and a new row will be added to your Google Sheet.

Tags:

AI AgentAutomationOpenAIGoogle SheetsExpense TrackingProductivityLangchainChatbotData Entry

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation