AI Chat Expense Tracker Agent for Google Sheets
Integrates with:
Overview
Unlock Effortless Expense Tracking with this AI Agent
This AI Agent revolutionizes how you track expenses. Simply send a message like "Lunch meeting; $25.50; today" to the n8n chat, and the agent takes care of the rest. It uses OpenAI's language understanding to extract the expense description, cost, and date, then seamlessly records it as a new row in your designated Google Sheet. Say goodbye to manual data entry and hello to streamlined financial record-keeping, directly from your chat interface.
Key Features & Benefits
- Conversational Expense Logging: Input expenses using natural language in n8n chat – no forms or spreadsheets needed.
- AI-Powered Data Extraction: Leverages OpenAI (GPT models) for accurate extraction of expense details (description, cost, date) from unstructured text.
- Automated Google Sheets Integration: New expenses are automatically appended to your Google Sheet, keeping records up-to-date.
- Interactive Chat Confirmation: Receive immediate feedback in chat confirming your expense has been saved, along with the structured data.
- Memory Enabled: The agent can remember previous parts of the conversation within a session (via Window Buffer Memory).
- Customizable & Extensible: Tailor the AI's parsing logic, system prompt, and Google Sheet configuration to your needs.
- Significant Time Savings: Eliminates the tedious task of manual expense entry, freeing up your time.
Use Cases
- Effortlessly track personal or business expenses on-the-go via chat.
- Simplify expense reporting for solopreneurs, freelancers, and small teams.
- Provide a quick and intuitive way for team members to submit minor expenses.
- Automate the initial data capture for bookkeeping, ensuring timely and accurate records.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to a suitable model (e.g., gpt-3.5-turbo, gpt-4).
- Google OAuth2 credentials configured in n8n for Google Sheets access.
- A Google Sheet ready for expense tracking (a template link is provided in setup instructions).
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Set up Google Sheets:
- Go to File -> Make a copy of the example Google Sheet: https://docs.google.com/spreadsheets/d/1D0r3tun7LF7Ypb21CmbTKEtn76WE-kaHvBCM5NdgiPU/edit?gid=0#gid=0
- In the n8n workflow, open the 'Save expense into Google Sheets' node. Select your Google Sheets credentials. Then, for 'Document ID', choose your copied spreadsheet, and for 'Sheet Name', select the relevant sheet (e.g., 'Sheet1' or use the 'gid=0' if that's your sheet ID).
- Configure OpenAI Credentials:
- In the 'OpenAI Chat Model' node (connected to 'AI Agent') and the 'OpenAI Chat Model1' node (connected to 'Expense text to JSON parser'), select your configured OpenAI API credentials.
- Configure Sub-workflow (Crucial Step):
- Open the 'Parse msg and save to Sheets' node. This node is a Langchain Tool that executes another part of this same workflow.
- In the 'Workflow' parameter dropdown, you must select this current workflow by its name (e.g., 'AI agent: expense tracker in Google Sheets and n8n chat' or the name it has after your import). This allows the AI Agent to call the expense parsing logic.
- Review AI Agent Instructions:
- Optionally, inspect the 'AI Agent' node. The 'System Message' parameter instructs the AI. The default is: "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]""
- Activate the Workflow: Toggle the workflow to 'Active' in the n8n editor.
- Test: Send a message to the n8n chat trigger (you can find the webhook URL in the 'When chat message received' node after activating). For example: "Movie tickets; 30 EUR; last Friday". You should get a confirmation message in the chat and see a new row added to your Google Sheet.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation