{ "id": "69EBKpEZt4lL2zoE", "meta": { "instanceId": "0a70652f43c1b29dd16c35b61a38fd31c8004f58bc7e723bf43262a797407c77" }, "name": "Enrich Company Firmographic Data in Google Sheets with Explorium MCP", "tags": [], "nodes": [ { "id": "a86d2e8d-fb7f-4c69-86cf-32d06e6b0006", "name": "Google Sheets Trigger", "type": "n8n-nodes-base.googleSheetsTrigger", "position": [ 740, 360 ], "parameters": { "options": {}, "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "sheetName": { "__rl": true, "mode": "list", "value": "gid=0", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE/edit#gid=0", "cachedResultName": "Sheet1" }, "documentId": { "__rl": true, "mode": "list", "value": "1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE/edit?usp=drivesdk", "cachedResultName": "n8n test" } }, "typeVersion": 1 }, { "id": "392596bc-c926-480f-9d53-a531fbc47c22", "name": "Filter Valid Rows", "type": "n8n-nodes-base.if", "position": [ 960, 360 ], "parameters": { "options": {}, "conditions": { "options": { "version": 1, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "8c7d5b8a-4569-4c8f-b5e8-6c5f5e5c5e5c", "operator": { "type": "string", "operation": "notEmpty" }, "leftValue": "={{ $json.name }}", "rightValue": "" }, { "id": "9d8e6c9b-5670-5d9f-c6f9-7d6g6f6d6f6d", "operator": { "type": "string", "operation": "notEmpty" }, "leftValue": "={{ $json.website }}", "rightValue": "" } ] } }, "typeVersion": 2 }, { "id": "65b0b21d-a94e-47aa-844a-427434f86c80", "name": "Loop Over Items", "type": "n8n-nodes-base.splitInBatches", "position": [ 1180, 360 ], "parameters": { "options": {} }, "typeVersion": 3 }, { "id": "9bf9fcd3-8a34-44ea-942f-a1f7f2cd9bc3", "name": "AI Agent", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 1440, 220 ], "parameters": { "text": "=You will be provided with company information including:\n\nName: {{ $json.name }}\nDomain: {{ $json.website }}\n\nYour task is to research and extract the following key business metrics for this company:\nRequired Data Points:\n- Name (keep the same as provided)\n- Website (keep the same as provided)\n- Annual revenue (as business_id first, then get the range)\n- Number of employees (range)\n- NAICS code\n\nUse the Explorium tools to:\n1. First use match-business to find the business ID\n2. Then use enrich-businesses-firmographics to get the company details\n\nReturn the data exactly in this format.", "options": {}, "promptType": "define", "hasOutputParser": true }, "typeVersion": 1.6 }, { "id": "4b6c6819-dbd8-4a2a-96cd-106ae9707562", "name": "Anthropic Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic", "position": [ 1400, 400 ], "parameters": { "model": { "__rl": true, "mode": "list", "value": "claude-sonnet-4-20250514", "cachedResultName": "Claude Sonnet 4" }, "options": {} }, "typeVersion": 1.3 }, { "id": "853553a7-1ca5-43c9-a623-139aa1df650e", "name": "Code - Format Output", "type": "n8n-nodes-base.code", "position": [ 1840, 220 ], "parameters": { "jsCode": "// Simply pass through the AI output with proper formatting\nreturn {\n name: $json.output.name || $json.name,\n website: $json.output.website || $json.website,\n business_id: $json.output.business_id || '',\n naics: $json.output.naics || '',\n number_of_employees_range: $json.output.number_of_employees_range || '',\n yearly_revenue_range: $json.output.yearly_revenue_range || ''\n};" }, "typeVersion": 2 }, { "id": "ab195be5-0150-4562-a1d6-5efcc5abd81e", "name": "Update Company Row", "type": "n8n-nodes-base.googleSheets", "position": [ 2060, 360 ], "parameters": { "columns": { "value": {}, "schema": [ { "id": "name", "type": "string", "display": true, "removed": false, "required": false, "displayName": "name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "website", "type": "string", "display": true, "removed": false, "required": false, "displayName": "website", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "business_id", "type": "string", "display": true, "removed": false, "required": false, "displayName": "business_id", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "naics", "type": "string", "display": true, "removed": false, "required": false, "displayName": "naics", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "number_of_employees_range", "type": "string", "display": true, "removed": false, "required": false, "displayName": "number_of_employees_range", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "yearly_revenue_range", "type": "string", "display": true, "removed": false, "required": false, "displayName": "yearly_revenue_range", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "autoMapInputData", "matchingColumns": [ "name" ] }, "options": {}, "operation": "appendOrUpdate", "sheetName": { "__rl": true, "mode": "list", "value": "gid=0", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE/edit#gid=0", "cachedResultName": "Sheet1" }, "documentId": { "__rl": true, "mode": "list", "value": "1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1bAMUxQ2UCU_rd1khEkNZ0RKqmBzal7eKk90-AnVScQE/edit?usp=drivesdk", "cachedResultName": "n8n test" } }, "typeVersion": 4.5 }, { "id": "701c0d2b-e221-45ad-a6ca-9e5da7f4a681", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 740, 620 ], "parameters": { "color": 5, "width": 460, "height": 280, "content": "# Enrich Company Data from Google Sheets with Explorium MCP\n\nThis workflow automatically enriches company data when new rows are added or when the name/website fields are updated in your Google Sheet." }, "typeVersion": 1 }, { "id": "f1e21787-fb1b-4747-a1ab-53383c80a5e5", "name": "Explorium MCP", "type": "@n8n/n8n-nodes-langchain.mcpClientTool", "position": [ 1540, 400 ], "parameters": { "sseEndpoint": "https://mcp.explorium.ai/sse", "authentication": "bearerAuth" }, "typeVersion": 1 }, { "id": "86095e96-e388-44e2-8702-2bef6f75f056", "name": "Output Parser", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "position": [ 1680, 400 ], "parameters": { "jsonSchemaExample": "{\n \"name\": \"Microsoft Corporation\",\n \"website\": \"https://www.microsoft.com\",\n \"business_id\": \"a34bacf839b923770b2c360eefa26748\",\n \"naics\": \"511210\",\n \"number_of_employees_range\": \"10001+\",\n \"yearly_revenue_range\": \"100B-1T\"\n}" }, "typeVersion": 1.2 }, { "id": "2d61c363-0e33-44f0-af98-611e272451b9", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1240, 620 ], "parameters": { "width": 460, "height": 280, "content": "### Workflow Structure:\n\n**Google Sheets Trigger** → **Filter Valid Rows** → **Loop Over Items**\n ↓\n **AI Agent**\n ↓\n **Code - Format Output**\n ↓\n **Update Company Row**\n ↓\n (back to Loop Over Items)" }, "typeVersion": 1 }, { "id": "96b09692-593c-44b5-b5c5-9cfc09ef4a4a", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 1740, 620 ], "parameters": { "color": 4, "width": 460, "height": 460, "content": "### How the Loop Works:\n1. Loop Over Items splits the batch (size 1)\n2. Sends one item to AI Agent\n3. AI Agent enriches the data\n4. Code formats the output\n5. Google Sheets updates the row\n6. Flow returns to Loop Over Items for next item\n7. When all items are processed, loop ends\n\n### Key Points:\n- Each row is processed individually\n- The loop continues until all rows are done\n- Failed enrichments won't stop other rows\n\n### Testing:\n1. Add multiple rows with company names and websites\n2. Trigger the workflow\n3. Watch each row get processed sequentially\n4. All rows should be updated with enriched data" }, "typeVersion": 1 } ], "active": false, "pinData": { "Google Sheets Trigger": [ { "json": { "name": "Amazon.com, Inc.", "naics": 454110, "website": "https://www.amazon.com", "row_number": 9, "business_id": "8f19793b2671094e63a15ab883d50137", "change_type": "updated", "yearly_revenue_range": "100B-1T", "number_of_employees_range": "10001+" } }, { "json": { "name": "Toyota North America", "naics": 336111, "website": "https://careers.toyota.com/us/en", "row_number": 10, "business_id": "9185f3ec501c674c7c788464a36e7fb3", "change_type": "updated", "yearly_revenue_range": "10B-100B", "number_of_employees_range": "10001+" } }, { "json": { "name": "The Coca-Cola Company", "naics": 312112, "website": "https://www.coca-colacompany.com", "row_number": 11, "business_id": "26751be1181460baf78db8d5eb7aad39", "change_type": "updated", "yearly_revenue_range": "10B-100B", "number_of_employees_range": "10001+" } } ] }, "settings": { "executionOrder": "v1" }, "versionId": "aae5fb81-550b-4b5e-bad4-05dc4248f30a", "connections": { "AI Agent": { "main": [ [ { "node": "Code - Format Output", "type": "main", "index": 0 } ] ] }, "Explorium MCP": { "ai_tool": [ [ { "node": "AI Agent", "type": "ai_tool", "index": 0 } ] ] }, "Output Parser": { "ai_outputParser": [ [ { "node": "AI Agent", "type": "ai_outputParser", "index": 0 } ] ] }, "Loop Over Items": { "main": [ [], [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "Filter Valid Rows": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Update Company Row": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Anthropic Chat Model": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Code - Format Output": { "main": [ [ { "node": "Update Company Row", "type": "main", "index": 0 } ] ] }, "Google Sheets Trigger": { "main": [ [ { "node": "Filter Valid Rows", "type": "main", "index": 0 } ] ] } } }