Description:
Overview
This workflow generates automated revenue and expense comparison reports from a structured Google Sheet. It enables users to compare financial data across the current period, last month, and last year, then uses an AI agent to analyze and summarize the results for business reporting.
Prerequisites
A connected Google Sheets OAuth2 credential.
A valid DeepSeek AI API (or replaceable with another Chat Model).
A sub-workflow (child workflow) that handles processing logic.
Properly structured Google Sheets data (see below).
Required Google Sheet Structure
Column headers must include at least: Date, Amount, Type.
Setup Steps
Import the workflow into your n8n instance.
Connect your Google Sheets and DeepSeek API credentials.
Update:
Sheet ID and Tab Name (already embedded in node: Get revenual from google sheet).
Custom sub-workflow ID (in the Call n8n Workflow Tool node).
Optionally configure chatbot webhook in the When chat message received node.
Fetches raw transaction data from Google Sheets.
Segments and pivots revenue by classification for:
Current period
Last month
Last year
Aggregates totals and applies custom titles for comparison.
Merges all summaries into a final unified JSON report.
Change the date fields or cycle comparisons (e.g., quarterly, weekly).
Add more AI analysis steps such as sentiment scoring or forecasting.
Modify the pivot logic to suit specific KPI tags or labels.
If parsing errors: verify that all dates follow the expected format.
Sub-workflow must be active and configured to accept the correct inputs (6 dates).