AI Accountant for Google Sheets Expense Tracking via Chat Interface - n8n Workflow

Automate expense logging using an n8n AI agent. This powerful n8n workflow parses unstructured chat messages and logs structured data directly into Google Sheets, leveraging advanced n8n node configurations.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Individuals who need a quick, conversational way to track personal expenses.

  • Teams looking to simplify expense reporting without complex forms.

  • n8n users seeking practical examples of building complex AI agents and sub-workflows.

  • Developers wanting to implement smart data parsing using an n8n information extractor node.

Overview

Keeping track of daily expenses often requires switching contexts or filling out rigid forms. This smart n8n workflow solves that by providing a conversational interface within the n8n platform itself. By leveraging the power of an n8n AI Agent and custom tools, you can simply type an unstructured message—such as 'car wash; 59.3 usd; 25 jan 2024'—and the system automatically extracts the key data points (cost, description, date). The n8n workflow then securely logs this structured information into a designated Google Sheet. This specialized n8n template demonstrates advanced linking between a main automation path and a reusable sub-workflow via the workflow tool n8n node, offering a highly efficient method for data capture and management.

How it Works

This automation functions across two tightly integrated paths:


  1. Triggering the Agent: The process begins with the 'When chat message received' n8n trigger. Any message sent to the associated n8n chat interface activates the primary path.

  2. AI Decision Making: The input is sent to the 'AI Agent' n8n node. Configured as a helpful accountant, the agent's system message directs it to use the saveexpensein_db tool (which is a reference to the sub-workflow) if the message contains expense information.

  3. Tool Execution (Sub-workflow Call): The 'Parse msg and save to Sheets' n8n node, acting as the tool, executes the sub-workflow, passing the raw expense text as input1 via an internal API call.

  4. Sub-workflow Trigger: The sub-workflow starts with the 'Workflow Input Trigger' n8n trigger, receiving the expense text.

  5. Data Parsing: The text is passed to the 'Expense text to JSON parser' n8n node (an Information Extractor). Using the connected OpenAI Chat Model, the AI structures the unstructured text into a clean JSON object containing cost, descr, and date fields.

  6. Final Logging: The structured data is finally sent to the 'Save expense into Google Sheets' n8n node, which appends a new row to the specified spreadsheet, completing the logging process. The n8n workflow then returns the structured JSON back to the AI Agent for confirmation to the user.

Installation Guide

To deploy this comprehensive n8n workflow and its associated n8n templates, follow these steps:


  1. Import: Copy the provided JSON and import it into your n8n instance.

  2. Credentials Setup: Configure credentials for:

OpenAI: Set up the 'OpenAi account' credentials used by both Chat Model nodes.
Google Sheets: Set up the 'Google Sheets account' OAuth2 credentials.

  1. Google Sheet Preparation: Clone the recommended Google Sheet structure (or create a sheet with Date, Cost, Descr, and Msg columns).

  2. Link Google Sheet Node: In the 'Save expense into Google Sheets' n8n node, select the Google Sheet you created/cloned.

  3. Fix Sub-workflow Reference: Open the 'Parse msg and save to Sheets' n8n node. In the Workflow ID dropdown, you must select the current workflow (AI agent: expense tracker in Google Sheets and n8n chat). This recursive link is vital for the n8n agent to correctly call its tool.

  4. Activation: Ensure the n8n workflow is active. Access the Chat interface in n8n and test by typing an expense message (e.g., "lunch at bistro, 45.00 eur, today").

Node Details

This n8n workflow utilizes several advanced n8n nodes:

When chat message received (n8n trigger): The entry point for the entire automation, activating upon receiving user input in the n8n chat.
AI Agent (n8n node): Orchestrates the conversation and decides which tool to use. Key Configuration: System Message instructs it to act as an accountant and use the save to db tool.
Window Buffer Memory (n8n node): Provides conversational history, allowing the AI Agent to remember previous messages within the session.
Parse msg and save to Sheets (Tool Workflow n8n node): This is a custom tool for the AI Agent. Function: It calls the sub-workflow execution path. Key Configuration: Recursively set to call the current n8n workflow ID.
Workflow Input Trigger (n8n trigger): The entry point for the sub-workflow, receiving the raw text input from the Tool node.
Expense text to JSON parser (Information Extractor n8n node): Function: Uses the OpenAI model to analyze the text and extract structured data (cost, description, date) based on a defined schema. This demonstrates powerful AI integration within an n8n node.


  • Save expense into Google Sheets (Google Sheets n8n node): Function: Appends the structured expense data as a new row. Key Configuration: Operation set to 'Append', with column mapping based on the AI-parsed JSON output.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

I am a software engineer and technical lead with over 15 years of experience, and I am passionate about building and scaling SaaS products. ScrapeNinja.net (bootstrapped) has been the most exciting and challenging product I have built so far. ScrapeNinja is primarily aimed at fellow developers and founders of software products, and it tries to alleviate the major pains of reliable, observable and scalable web scraping and feeding data into LLMs.

Featured*