Back to Templates

Track Expenses from Receipt Photos with AI, Google Sheets & Slack Reports

Created by

Created by: takuma || takuma

takuma

Last update

Last update 3 hours ago

Share


Who’s it for

This template is for individuals or households who want to:

  • Easily digitize and track their spending from physical receipts.
  • Automate budget management and financial reporting.
  • Get quick insights into their spending habits on a daily and monthly basis.
  • Stay informed about their remaining budget through Slack notifications.

What it does

This workflow automates your household budget tracking in several steps:

  1. Receipt Photo Upload: You upload a photo of your receipt to a webhook.
  2. Parse Receipt: An AI agent extracts the date, store name, purchased items, and total amount from the receipt text.
  3. Add to Budget Sheet: The extracted data is then appended to your designated Google Sheet.
  4. Daily Budget Report: After each receipt entry, the workflow calculates your current month's spending, remaining budget, and sends a summary to Slack.
  5. Monthly Budget Report: Once a day (triggered by a cron job), it reads all budget data for the current month from Google Sheets, performs an analysis (total spending, daily average, top stores, items, and spending days), and sends a comprehensive report to Slack.

How to set up

Requirements

  • n8n Account: Self-hosted or Cloud.
  • Google Sheets: A Google Sheet set up with columns for "Date", "Store", "Items", and "Amount".
  • Slack Workspace: A Slack channel where you want to receive budget updates.
  • OpenRouter Account: An API key for OpenRouter to use their chat models.

Steps

  1. Google Sheets Setup:

    • Create a new Google Sheet (or use an existing one) and name it "Household Budget".
    • In the first sheet (e.g., "Sheet1"), set up the following headers in the first row: "Date", "Store", "Items", "Amount".
    • Share the Google Sheet with the service account email associated with your n8n Google Sheets credentials, granting "Editor" access.
    • In the 'Add to Budget Sheet' and 'Get Budget Sheet (Daily)' nodes, select your Google Sheet and the appropriate sheet name.
  2. OpenRouter Credentials:

    • Sign up or log in to OpenRouter (https://openrouter.ai/).
    • Generate an API key.
    • In n8n, create a new "OpenRouter" credential using your API key. Apply this credential to the 'OpenRouter Chat Model1', 'OpenRouter Chat Model2', and 'OpenRouter Chat Model' nodes.
  3. Slack Credentials:

    • In n8n, create a new "Slack" credential. Follow the instructions to connect your Slack workspace.
    • In the 'Send a message' and 'Send monthly report' nodes, select the Slack channel where you want to receive messages.
    • Make sure the Slack app has permission to post to the selected channels.
  4. Webhook URLs:

    • After activating the workflow, the 'Receipt Photo Upload' node will generate a webhook URL. Copy this URL. You will use this URL to send receipt text (e.g., from a mobile app that scans text).
  5. Monthly Budget Adjustment:

    • In the 'Code in JavaScript2' node, locate the line const budget = 30000; and change 30000 to your desired monthly budget in JPY.

How to customize the workflow

Daily Report Trigger

The 'Daily Report Trigger' node is set to run once a day. You can modify its schedule to trigger more or less frequently by adjusting its cron settings.

AI Model

You can change the AI models used in the 'OpenRouter Chat Model' nodes to any other large language model supported by n8n, such as OpenAI, Anthropic, or custom hosted models, by updating the credentials and model names.

Output Formatting

The Slack messages generated by the 'Report Budget' and 'Monthly Report' nodes can be customized by editing the systemMessage and text parameters in those nodes to change the tone, content, or language of the reports.

Additional Integrations

You can extend this workflow by adding more nodes:

  • Integrate with other accounting software.
  • Send notifications to different platforms (e.g., email, Discord, Telegram).
  • Add sentiment analysis to your spending habits.
  • Categorize expenses automatically based on items or stores using another AI node.