AI agent: expense tracker in Google Sheets and n8n chat n8n Workflow Template

n8n workflow template · 9 nodes · OpenAI

AI agent: expense tracker in Google Sheets and n8n chat is a free n8n workflow template that starts when a chat message is received and works with OpenAI and Google Sheets. It has 9 nodes, 7 of them AI nodes (AI Agent, Chat Trigger, OpenAI Chat Model and Window Buffer Memory). The notes inside the workflow say: “LLM will parse your message to structured JSON and save as a new row into Google Sheet.” To run it, you add your own credentials for Google Sheets OAuth2 and OpenAI API.

At a glance

Trigger
Chat Trigger (When chat message received)
Nodes
9
Apps
OpenAI and Google Sheets
AI nodes
7
Credentials
2 types
Category
Spreadsheets, databases and docs

Apps and integrations

  • OpenAI
  • Google Sheets

Node types used

  • AI Agent
  • Chat Trigger
  • Execute Workflow Trigger
  • OpenAI Chat Model
  • Window Buffer Memory
  • Information Extractor
  • Google Sheets
  • Call n8n Workflow Tool

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Save your expenses via chat message.

LLM will parse your message to structured JSON and save as a new row into Google Sheet.

Installation

1. Set up Google Sheets

Clone this Sheet

(File -> Make a copy)

Choose this sheet into "Save expense into Google Sheets" node.

2. Fix sub-workflow dropdown

open "Parse msg and save to Sheets" node (which is an n8n sub-workflow executor tool) and choose the SAME workflow in the dropdown. it will allow n8n to call "Workflow Input Trigger" properly when needed.

3. Activate the workflow to make chat work properly.

Sent message to chat, something like "car wash; 59.3 usd; 25 jan 2024"

you should get a response: 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 new row in Google sheets should be inserted!

Nodes in this workflow

The 9 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. AI Agent (AI Agent)
  2. When chat message received (Chat Trigger)
  3. Workflow Input Trigger (Execute Workflow Trigger)
  4. OpenAI Chat Model (OpenAI Chat Model)
  5. Window Buffer Memory (Window Buffer Memory)
  6. OpenAI Chat Model1 (OpenAI Chat Model)
  7. Expense text to JSON parser (Information Extractor)
  8. Save expense into Google Sheets (Google Sheets)
  9. Parse msg and save to Sheets (Call n8n Workflow Tool)Make sure that this SAME workflow is chosen in the Workflow dropdown!

Credentials you need

  • Google Sheets OAuth2 – used by Save expense into Google Sheets
  • OpenAI API – used by OpenAI Chat Model and OpenAI Chat Model1

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us