This workflow corresponds to n8n.io template #4612 — we link there as the canonical source.
This workflow follows the Execute Workflow Trigger → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "VjYVuVxMuX9MbtGy",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "MCP Personal Expense",
"tags": [],
"nodes": [
{
"id": "544866c7-9676-4a94-a77d-8637b8b9f6e3",
"name": "MCP Server Trigger",
"type": "@n8n/n8n-nodes-langchain.mcpTrigger",
"position": [
-1560,
360
],
"parameters": {
"path": "personal-expense"
},
"typeVersion": 1
},
{
"id": "f45e1509-487b-46c6-b7dd-224df465c981",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
1360,
-340
],
"parameters": {
"options": {
"ignoreCase": true
},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c804feba-d6da-43d9-88a9-24dfa0f7a2ed",
"operator": {
"type": "dateTime",
"operation": "afterOrEquals"
},
"leftValue": "={{ $json.date }}",
"rightValue": "={{ $('Switch').item.json.payload.dateStart }}"
},
{
"id": "512eb3ab-f42d-4a35-bc0e-7ff67ab0d6a5",
"operator": {
"type": "dateTime",
"operation": "beforeOrEquals"
},
"leftValue": "={{ $json.date }}",
"rightValue": "={{ $('Switch').item.json.payload.dateEnd }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f4411283-0efa-4218-8d96-9d9a1c7c19e6",
"name": "Google Sheets Filter Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-40,
420
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "function"
},
{
"name": "payload",
"type": "object"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "827737c1-4466-499c-abae-bc2e03d9191a",
"name": "Get list transactions",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-1880,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Get Transactions",
"workflowInputs": {
"value": {
"payload": "={\n \"dateStart\": \"{{ $fromAI(\"dateStart\", \"Date Start. Format: YYYY-MM-DD\", \"string\") }}\",\n \"dateEnd\": \"{{ $fromAI(\"dateEnd\", \"Date End. Format: YYYY-MM-Dd\", \"string\") }}\"\n}",
"function": "list_transaction"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "afb64fd3-d554-4f4f-9447-3a5cd48bae1a",
"name": "Get By ID",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
-1740,
560
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}",
"lookupColumn": "id"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
},
"descriptionType": "manual",
"toolDescription": "Get Data by ID"
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "05b35a22-757d-411f-ad56-a1b0e3d7a695",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
380,
320
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "list_transaction",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3e9f8105-2bd7-4571-8909-86cddbf4e3eb",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "list_transaction"
}
]
},
"renameOutput": true
},
{
"outputKey": "remove_transaction",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8bba675d-4f2f-411d-858e-cd0573f2a0d7",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "remove_transaction"
}
]
},
"renameOutput": true
},
{
"outputKey": "add_transaction",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1cf7fe89-f22e-4656-9e16-570f4b7088f0",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "add_transaction"
}
]
},
"renameOutput": true
},
{
"outputKey": "update_transaction",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f63ece2b-a821-4e79-8797-365fe6b6ce2b",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "update_transaction"
}
]
},
"renameOutput": true
},
{
"outputKey": "add_budget",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "411a0ece-ac3a-49fe-b357-c7dc56f21042",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "add_budget"
}
]
},
"renameOutput": true
},
{
"outputKey": "update_budget",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8bac74de-c55c-4248-a2a7-728d8acae09a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "update_budget"
}
]
},
"renameOutput": true
},
{
"outputKey": "remove_budget",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "818c0b7b-c1b0-4150-b683-76287f0fd1f8",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "remove_budget"
}
]
},
"renameOutput": true
},
{
"outputKey": "get_budget",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "579f8f4d-7ce0-46cf-aee5-290d5025f071",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.function }}",
"rightValue": "get_budget"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "e7ac76ec-a796-429a-85d0-44490cfe4f00",
"name": "get by id",
"type": "n8n-nodes-base.googleSheets",
"position": [
880,
100
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.payload.id }}",
"lookupColumn": "id"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "d7ea9a2f-b9ef-4a02-92f7-25ec2c3a9232",
"name": "remove transaction",
"type": "n8n-nodes-base.googleSheets",
"position": [
1160,
100
],
"parameters": {
"operation": "delete",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
},
"startIndex": "={{ $json.row_number }}"
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "f6fe072a-ef50-4f95-87a6-e7b0e047127e",
"name": "get all transactions",
"type": "n8n-nodes-base.googleSheets",
"position": [
1120,
-200
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "7af5ea63-d59b-49e6-9a42-c5e85ec4650e",
"name": "Remove Transaction",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-1600,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Remove Transaction",
"workflowInputs": {
"value": {
"payload": "={\n \"id\": \"{{ $fromAI(\"id\", \"ID\", \"string\") }}\"\n}",
"function": "remove_transaction"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "e8c38268-0876-461a-8b89-ed121c321d4a",
"name": "Crypto",
"type": "n8n-nodes-base.crypto",
"position": [
880,
520
],
"parameters": {
"action": "generate",
"dataPropertyName": "id"
},
"typeVersion": 1
},
{
"id": "ed85ffef-9a72-4025-a0e6-7f57eb9c4a0a",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
1280,
520
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4e34ce93-3976-4f74-8933-32bc34bc459c",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "expense"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "085c44bd-dfbc-4a37-9f47-c9562e54b699",
"name": "Get existing budget",
"type": "n8n-nodes-base.googleSheets",
"position": [
1480,
500
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.date.substring(0, 7) }}",
"lookupColumn": "month"
},
{
"lookupValue": "={{ $json.category }}",
"lookupColumn": "category"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6,
"alwaysOutputData": true
},
{
"id": "7e6e1808-4b96-42a0-a696-5ef7a5b1fc6e",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
1900,
320
],
"parameters": {
"jsCode": "\n\nreturn {\n \"id\": $(\"add transaction\").first().json.id,\n \"budget\": {},\n \"task\": \"Ask user to add monthly budget\"\n}"
},
"typeVersion": 2
},
{
"id": "4fe6970d-d46c-42c1-aa32-c5fa9a1f6b80",
"name": "add transaction",
"type": "n8n-nodes-base.googleSheets",
"position": [
1080,
520
],
"parameters": {
"columns": {
"value": {
"id": "={{ $json.id }}",
"date": "={{ $json.payload.date }}",
"type": "={{ $json.payload.type }}",
"month": "={{ $json.payload.date.substring(0,7) }}",
"amount": "={{ $json.payload.amount }}",
"purpose": "={{ $json.payload.purpose }}",
"category": "={{ $json.payload.category }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "purpose",
"type": "string",
"display": true,
"required": false,
"displayName": "purpose",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "amount",
"type": "string",
"display": true,
"required": false,
"displayName": "amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "month",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "month",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "e97f4b19-6d86-4c73-8d64-356c5a6f33fe",
"name": "budget not found?",
"type": "n8n-nodes-base.if",
"position": [
1660,
500
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d062f954-0a17-4870-b632-aebea115dad9",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "dcebec66-c750-4e64-8974-d659de8c0943",
"name": "Code1",
"type": "n8n-nodes-base.code",
"position": [
2140,
520
],
"parameters": {
"jsCode": "let totalExpenses = 0;\n\nfor (const item of $('Get Monthly Expenses').all()) {\n totalExpenses += item.json.amount \n}\n\nlet result = {\n \"id\": $('add transaction').first().json.id,\n \"budget\": {\n \"monthlyLimit\": $('Get existing budget').first().json.budget,\n \"remainingLimit\": $('Get existing budget').first().json.budget - totalExpenses\n },\n \"task\": \"\"\n}\n\nif (totalExpenses > $('Get existing budget').first().json.budget) {\n result.task = \"Give warning to user or suggest to adjust the budget\"\n}\n\nreturn result;"
},
"typeVersion": 2
},
{
"id": "9164bfe3-1549-4943-a489-c67da1d32d9d",
"name": "Get Monthly Expenses",
"type": "n8n-nodes-base.googleSheets",
"position": [
1900,
520
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.month }}",
"lookupColumn": "month"
},
{
"lookupValue": "={{ $json.category }}",
"lookupColumn": "category"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "ff8d7da3-c567-41f8-af20-88c3248822bb",
"name": "Add Transaction",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-1440,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Add Transaction",
"workflowInputs": {
"value": {
"payload": "={ \n \"date\": \"{{ $fromAI(\"date\", \"Transaction date. Format: YYYY-MM-DD\", \"string\") }}\", \n \"purpose\": \"{{ $fromAI(\"purpose\", \"Purpose of the transaction\", \"string\") }}\", \n \"category\": \"{{ $fromAI(\"category\", \"Transaction category\", \"string\") }}\",\n \"amount\": {{ $fromAI(\"amount\", \"Transaction amount\", \"number\") }}, \n \"type\": \"{{ $fromAI(\"type\", \"Transaction type. Can be expense or income\", \"string\") }}\"\n}",
"function": "add_transaction"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "e71da569-0165-4c3f-917a-b97843aba5bf",
"name": "Code2",
"type": "n8n-nodes-base.code",
"position": [
1500,
700
],
"parameters": {
"jsCode": "\nreturn {\n \"id\": $('add transaction').first().json.id,\n \"budget\": {},\n \"task\": \"Congratulate user for new income.\"\n}"
},
"typeVersion": 2
},
{
"id": "f601629b-975a-48ba-a832-f53003776246",
"name": "Update transaction",
"type": "n8n-nodes-base.googleSheets",
"position": [
900,
1020
],
"parameters": {
"columns": {
"value": {
"id": "={{ $json.payload.id }}",
"date": "={{ $json.payload.date }}",
"type": "={{ $json.payload.type }}",
"month": "={{ $json.payload.date.substring(0,7) }}",
"amount": "={{ $json.payload.amount }}",
"purpose": "={{ $json.payload.purpose }}",
"category": "={{ $json.payload.category }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "purpose",
"type": "string",
"display": true,
"required": false,
"displayName": "purpose",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "amount",
"type": "string",
"display": true,
"required": false,
"displayName": "amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "type",
"type": "string",
"display": true,
"required": false,
"displayName": "type",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "month",
"type": "string",
"display": true,
"required": false,
"displayName": "month",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "0bd3eebb-e341-49cc-87d3-c5ba6fe73da6",
"name": "If1",
"type": "n8n-nodes-base.if",
"position": [
1120,
1040
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4e34ce93-3976-4f74-8933-32bc34bc459c",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Update transaction').item.json.type }}",
"rightValue": "expense"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c82171bf-fae5-4407-9af3-c9abddff0b04",
"name": "Code3",
"type": "n8n-nodes-base.code",
"position": [
1840,
880
],
"parameters": {
"jsCode": "\n\nreturn {\n \"id\": $(\"Update transaction\").first().json.id,\n \"budget\": {},\n \"task\": \"Ask user to add monthly budget\"\n}"
},
"typeVersion": 2
},
{
"id": "740cbba3-76e5-42a4-b8c8-1a33f137a576",
"name": "budget not found?1",
"type": "n8n-nodes-base.if",
"position": [
1600,
1040
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d062f954-0a17-4870-b632-aebea115dad9",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "d297855a-d70d-43cb-83d6-df2e712698d8",
"name": "Code4",
"type": "n8n-nodes-base.code",
"position": [
2080,
1060
],
"parameters": {
"jsCode": "let totalExpenses = 0;\n\nfor (const item of $('Get Monthly Expenses1').all()) {\n totalExpenses += item.json.amount \n}\n\nlet result = {\n \"id\": $('Update transaction').first().json.id,\n \"budget\": {\n \"monthlyLimit\": $('Get existing budget2').first().json.budget,\n \"remainingLimit\": $('Get existing budget2').first().json.budget - totalExpenses\n },\n \"task\": \"\"\n}\n\nif (totalExpenses > $('Get existing budget2').first().json.budget) {\n result.task = \"Give warning to user or suggest to adjust the budget\"\n}\n\nreturn result;"
},
"typeVersion": 2
},
{
"id": "3369be8c-67cc-4b2d-9c04-fb712afa6509",
"name": "Get Monthly Expenses1",
"type": "n8n-nodes-base.googleSheets",
"position": [
1840,
1060
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.month }}",
"lookupColumn": "month"
},
{
"lookupValue": "={{ $json.category }}",
"lookupColumn": "category"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "4ae8401e-0ad5-43b4-aa72-b04edc150d4d",
"name": "Code5",
"type": "n8n-nodes-base.code",
"position": [
1440,
1240
],
"parameters": {
"jsCode": "\nreturn {\n \"id\": $('add transaction').first().json.id,\n \"budget\": {},\n \"task\": \"Congratulate user for new income.\"\n}"
},
"typeVersion": 2
},
{
"id": "ebcd4517-f735-4378-8c25-1b48e4593808",
"name": "Get Existing Budget",
"type": "n8n-nodes-base.googleSheets",
"position": [
920,
1500
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.payload.category }}",
"lookupColumn": "category"
},
{
"lookupValue": "={{ $json.payload.month }}",
"lookupColumn": "month"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6,
"alwaysOutputData": true
},
{
"id": "76132552-d70d-46dd-add6-39436430699f",
"name": "Get existing budget2",
"type": "n8n-nodes-base.googleSheets",
"position": [
1420,
1040
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.date.substring(0, 7) }}",
"lookupColumn": "month"
},
{
"lookupValue": "={{ $json.category }}",
"lookupColumn": "category"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6,
"alwaysOutputData": true
},
{
"id": "4d91a329-61d5-4ceb-a51a-27278c9112ad",
"name": "Add budget",
"type": "n8n-nodes-base.googleSheets",
"position": [
1440,
1480
],
"parameters": {
"columns": {
"value": {
"month": "={{ $('Switch').item.json.payload.month }}",
"budget": "={{ $('Switch').item.json.payload.amount }}",
"category": "={{ $('Switch').item.json.payload.category }}"
},
"schema": [
{
"id": "month",
"type": "string",
"display": true,
"required": false,
"displayName": "month",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "budget",
"type": "string",
"display": true,
"required": false,
"displayName": "budget",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "83c5093e-fa10-4bcc-b684-e5bd22fdfd00",
"name": "Code6",
"type": "n8n-nodes-base.code",
"position": [
1440,
1680
],
"parameters": {
"jsCode": "\n\nreturn {\n \"task\": \"Budget already exists. Ask user to update it instead.\"\n}"
},
"typeVersion": 2
},
{
"id": "f83089ee-33de-48a0-8440-f02988ddd736",
"name": "Get Existing Budget1",
"type": "n8n-nodes-base.googleSheets",
"position": [
940,
1960
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.payload.month }}",
"lookupColumn": "month"
},
{
"lookupValue": "={{ $json.payload.category }}",
"lookupColumn": "category"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "84bcedda-5a53-4dbe-a2d9-811f96f13fd6",
"name": "Code7",
"type": "n8n-nodes-base.code",
"position": [
1360,
1940
],
"parameters": {
"jsCode": "\n\nreturn {\n \"task\": \"Budget not found. Ask user to add budget instead.\"\n}"
},
"typeVersion": 2
},
{
"id": "d761eb69-7f8d-4f7a-9f16-f06a863fa2a6",
"name": "Update Budget",
"type": "n8n-nodes-base.googleSheets",
"position": [
1360,
2120
],
"parameters": {
"columns": {
"value": {
"month": "={{ $('Switch').item.json.payload.month }}",
"budget": "={{ $('Switch').item.json.payload.amount }}",
"category": "={{ $('Switch').item.json.payload.category }}",
"row_number": "={{ $json.row_number }}"
},
"schema": [
{
"id": "month",
"type": "string",
"display": true,
"required": false,
"displayName": "month",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "budget",
"type": "string",
"display": true,
"required": false,
"displayName": "budget",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "1ea98857-1eac-4135-87b9-be5b89df0a0f",
"name": "Get Existing Budget2",
"type": "n8n-nodes-base.googleSheets",
"position": [
940,
2420
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.payload.category }}",
"lookupColumn": "category"
},
{
"lookupValue": "={{ $json.payload.month }}",
"lookupColumn": "month"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1146268703,
"cachedResultUrl": "",
"cachedResultName": "budgets"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6,
"alwaysOutputData": true
},
{
"id": "2c3cc9d2-2001-4698-9529-1373c43bebef",
"name": "budget not found?4",
"type": "n8n-nodes-base.if",
"position": [
1120,
2420
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d062f954-0a17-4870-b632-aebea115dad9",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "32259e82-ea9f-475f-9b5d-609e1bc63595",
"name": "Code8",
"type": "n8n-nodes-base.code",
"position": [
1360,
2400
],
"parameters": {
"jsCode": "\n\nreturn {\n \"task\": \"Budget not found, nothing to remove.\"\n}"
},
"typeVersion": 2
},
{
"id": "d5f55296-427e-4525-b71a-7015b89b9215",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2580,
260
],
"parameters": {
"width": 2040,
"height": 540,
"content": "## MCP Main tools\n\nThis is an MCP main entry point. \nIt has several tools that are available to use by AI client.\n\nMost of the tools will execute another workflow\n\n\n### How to use\n\n* You need to be able to sign in via google in order to use google sheets node. \n Refer to this [documentation](https://docs.n8n.io/integrations/builtin/credentials/google/) on how to sign in with google.\n* Copy this [google sheet template](https://docs.google.com/spreadsheets/d/1XzoYEZflj1Rdo2MVKosRqXHSjkazE5vuwYWHLybX4b0/edit?usp=sharing)\n* after you copy the sheet, make sure you enable sharing with everyone who has the link\n* In each google sheet nodes, change `document` source to `By URL`, paste the link in the URL field\n* For the nodes that related to transaction, change the `sheet` target to `transactions`\n* For the nodes that related to budget, change the `sheet` target to `budgets`"
},
"typeVersion": 1
},
{
"id": "605dcb3d-1bd9-403a-b50a-75ffdb755c0a",
"name": "Update Transaction",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-1280,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Update Transaction",
"workflowInputs": {
"value": {
"payload": "={ \n \"id\": \"{{ $fromAI(\"id\", \"UUID of the transaction.\", \"string\") }}\",\n \"date\": \"{{ $fromAI(\"date\", \"Transaction date. Format: YYYY-MM-DD\", \"string\") }}\", \n \"purpose\": \"{{ $fromAI(\"purpose\", \"Purpose of the transaction\", \"string\") }}\", \n \"category\": \"{{ $fromAI(\"category\", \"Transaction category\", \"string\") }}\",\n \"amount\": {{ $fromAI(\"amount\", \"Transaction amount\", \"number\") }}, \n \"type\": \"{{ $fromAI(\"type\", \"Transaction type. Can be expense or income\", \"string\") }}\"\n}",
"function": "update_transaction"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "65352e90-d0b3-4a93-94bc-a31e32efb6ea",
"name": "Add Budget",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-1120,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Add monthly budget",
"workflowInputs": {
"value": {
"payload": "={ \n \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\", \n \"amount\": {{ $fromAI(\"amount\", \"Budget amount\", \"number\") }}\n}",
"function": "add_budget"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "6c1666ec-7ebd-4f61-98db-06dc6c892892",
"name": "Update Budget Tool",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-980,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Update monthly budget",
"workflowInputs": {
"value": {
"payload": "={ \n \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\", \n \"amount\": {{ $fromAI(\"amount\", \"Budget amount\", \"number\") }}\n}",
"function": "update_budget"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "2544655e-d5fd-476f-9185-5fe67f28b425",
"name": "Remove Budget",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-820,
560
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "VjYVuVxMuX9MbtGy",
"cachedResultName": "MCP Personal Expense"
},
"description": "Remove Budget",
"workflowInputs": {
"value": {
"payload": "={ \n \"month\": \"{{ $fromAI(\"month\", \"Budget month. Format : YYYY-MM\", \"string\") }}\",\n \"category\": \"{{ $fromAI(\"category\", \"Budget category\", \"string\") }}\"\n}",
"function": "remove_budget"
},
"schema": [
{
"id": "function",
"type": "string",
"display": true,
"required": false,
"displayName": "function",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "payload",
"type": "object",
"display": true,
"required": false,
"displayName": "payload",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "021e523b-c47f-4b06-9104-279e7013df6b",
"name": "Execution Data",
"type": "n8n-nodes-base.executionData",
"position": [
180,
420
],
"parameters": {
"dataToSave": {
"values": [
{
"key": "function",
"value": "={{ $('Google Sheets Filter Workflow').item.json.function }}"
},
{
"key": "payload",
"value": "={{ JSON.stringify($('Google Sheets Filter Workflow').item.json.payload) }}"
}
]
}
},
"typeVersion": 1
},
{
"id": "dc42a268-4b4d-46a2-9caa-04400bccfbbc",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1620,
-420
],
"parameters": {
"color": 6,
"width": 580,
"height": 180,
"content": "### Get all transaction\n\nIt will get list of transactions. \n\nSince currently google sheets integration doesn't support date range filter, so if the start date and end date criterial fall into same month it will get data by filtering helper column `month`. But if they're different month, then it get all transactions"
},
"typeVersion": 1
},
{
"id": "acaaf56e-62c6-4b08-a7dc-2837fe153229",
"name": "If2",
"type": "n8n-nodes-base.if",
"position": [
840,
-360
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7fc9f6b2-f43e-41da-b3cb-969c70ac3b46",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.payload.dateStart.substring(0,7) }}",
"rightValue": "={{ $json.payload.dateEnd.substring(0,7) }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "31a41bd8-f14f-45a0-8611-5a778b502312",
"name": "get all transactions1",
"type": "n8n-nodes-base.googleSheets",
"position": [
1120,
-480
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.payload.dateStart.substring(0,7) }}",
"lookupColumn": "month"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "",
"cachedResultName": "transactions"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "7e99365b-555e-470d-bad1-1a406ba20a15",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1400,
40
],
"parameters": {
"color": 6,
"width": 320,
"height": 180,
"content": "### Remove transaction\n\nIt will remove transaction by ID. However we need to get the transaction first before removing to get row number. Because removing transaction needs a row number, can't be filtered by anything"
},
"typeVersion": 1
},
{
"id": "b470904a-69db-4e88-9656-ccc736114c87",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2380,
480
],
"parameters": {
"color": 6,
"width": 500,
"height": 200,
"content": "### Add transaction\n\nIt will add transaction to a new row. In this workflow it will also check for the existing budget.\n\nIn the response, it has `task` field that will tell AI client what to do next. Either it will suggest user to add budget, or give warning if the budget already reached or surpassed."
},
"typeVersion": 1
},
{
"id": "4ddd4f34-be88-40f9-bfbc-84c3707f485d",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2380,
1020
],
"parameters": {
"color": 6,
"width": 540,
"height": 200,
"content": "### Update transaction\n\nIt will update transaction by ID. In this workflow it will also check for the existing budget.\n\nIt has the same checking budget workflow with the add transaction. I have to duplicate it since in the end it needs to ID from the different previous node. Currently n8n doesn't allow check return value from the node that has not been executed."
},
"typeVersion": 1
},
{
"id": "4fe2b09d-ece3-4686-a3bd-8e80800957d0",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1700,
1460
],
"parameters": {
"color": 6,
"width": 340,
"height": 280,
"content": "### Add monthly budget\n\nIt will add monthly budget.\n\n#### pro tip :\nYou can ask AI client to add budget for several months by prompting such \n\n```\nAdd budget for fashion for this month until the end of the year, $500 per month\n```"
},
"typeVersion": 1
},
{
"id": "8e7b0528-61e7-43cb-941c-28cd4dd6e423",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1620,
2020
],
"parameters": {
"color": 6,
"width": 260,
"height": 120,
"content": "### update monthly budget\n\nIt will update budget"
},
"typeVersion": 1
},
{
"id": "7da84021-9af7-496e-8089-ac2237beba24",
"name": "budget not found?2",
"type": "n8n-nodes-base.if",
"position": [
1140,
1500
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d062f954-0a17-4870-b632-aebea115dad9",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b6c0e7ff-92b8-43cf-b037-8adfa2b07a05",
"name": "budget not found?3",
"type": "n8n-nodes-base.if",
"position": [
1140,
1960
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"co
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template provides a set of MCP tools to manage personal budgets and expenses. This MCP tools can be integrated to any AI client that support MCP integration. It stores transaction records and budget in google sheet It will give warning if expense is above budget Sign in…
Source: https://n8n.io/workflows/4612/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This MCP example uses PayCaptain.com as an example and shows how to create an MCP server which can search for and update employee data. A MCP server trigger is used and connected to 3 custom workflow
This n8n workflow lets you chat with your spreadsheets using AI + MCP! From reading and updating data to creating sheets, it’s your smart assistant for Google Sheets 📈🤖
Google Maps Email Scraper Template. Uses removeDuplicates, splitInBatches, httpRequest, splitOut. Event-driven trigger; 26 nodes.
Splitout Comparedatasets. Uses manualTrigger, gong, stickyNote, executeWorkflow. Event-driven trigger; 26 nodes.
Streamline your sales call analysis with CallForge, an automated workflow that extracts, enriches, and refines Gong.io call data for AI-driven insights.