
Salesforce-Google Sheets Company Sync (Smart Duplicate Prevention)
Description
Categories
π€ AI & Machine Learning
Nodes Used
n8n-nodes-base.ifn8n-nodes-base.setn8n-nodes-base.mergen8n-nodes-base.mergen8n-nodes-base.mergen8n-nodes-base.itemListsn8n-nodes-base.renameKeysn8n-nodes-base.salesforcen8n-nodes-base.salesforcen8n-nodes-base.salesforce
PriceKostenlos
Views0
Last Updated11/28/2025
workflow.json
{
"id": "ulMkyRjDpdND1gzn",
"meta": {
"instanceId": "f450cd0986d5bfb741d4d1b31068440b1642915c91f795fd72913ef923830e67",
"templateId": "1792"
},
"name": "Salesforce-Google Sheets Company Sync (Smart Duplicate Prevention)",
"tags": [
{
"id": "r7X6mNg8b6tE7HbJ",
"name": "template",
"createdAt": "2025-09-28T16:07:48.401Z",
"updatedAt": "2025-09-28T16:07:48.401Z"
}
],
"nodes": [
{
"id": "29451054-fcd6-4054-b072-a87c716f6c67",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-336,
-320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2c1ed019-85f1-4b0f-bcf5-ce59ff13ea49",
"name": "Search Salesforce accounts",
"type": "n8n-nodes-base.salesforce",
"position": [
112,
-384
],
"parameters": {
"query": "=SELECT id, Name FROM Account WHERE Name = '{{$json[\"Company Name\"].replace(/'/g, '\\\\\\'')}}'",
"resource": "search"
},
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "7da1de2f-2b37-4e33-b8d4-d1dc59e94bbe",
"name": "Account found?",
"type": "n8n-nodes-base.if",
"position": [
1152,
0
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json[\"Id\"] }}",
"operation": "isNotEmpty"
}
]
}
},
"typeVersion": 1
},
{
"id": "80890a2a-f6d3-4efd-92b1-6465f98f512b",
"name": "Remove duplicate companies",
"type": "n8n-nodes-base.itemLists",
"position": [
1312,
-448
],
"parameters": {
"compare": "selectedFields",
"options": {},
"operation": "removeDuplicates",
"fieldsToCompare": {
"fields": [
{
"fieldName": "Company Name"
}
]
}
},
"typeVersion": 1
},
{
"id": "ea9afa15-77be-4d7a-a287-35d4c1c6e6c1",
"name": "Set Account ID for existing accounts",
"type": "n8n-nodes-base.renameKeys",
"position": [
1520,
-16
],
"parameters": {
"keys": {
"key": [
{
"newKey": "Account ID",
"currentKey": "Id"
}
]
},
"additionalOptions": {}
},
"typeVersion": 1
},
{
"id": "c10dea7c-96b0-4f3b-b859-af094ced51cc",
"name": "Set new account name",
"type": "n8n-nodes-base.set",
"position": [
1760,
-448
],
"parameters": {
"values": {
"string": [
{
"name": "id",
"value": "={{ $json[\"id\"] }}"
},
{
"name": "Name",
"value": "={{ $node[\"Remove duplicate companies\"].json[\"Company Name\"] }}"
}
]
},
"options": {},
"keepOnlySet": true
},
"typeVersion": 1
},
{
"id": "a4a2be2a-7bd9-4a70-b4d9-0df53834bdda",
"name": "Create Salesforce account",
"type": "n8n-nodes-base.salesforce",
"position": [
1536,
-448
],
"parameters": {
"name": "={{ $json[\"Company Name\"] }}",
"resource": "account",
"additionalFields": {}
},
"typeVersion": 1
},
{
"id": "89f49e6f-62be-403f-9a4c-cd56e28141f3",
"name": "Create Salesforce contact",
"type": "n8n-nodes-base.salesforce",
"position": [
1840,
-16
],
"parameters": {
"lastname": "={{ $json[\"Last Name\"] }}",
"resource": "contact",
"operation": "upsert",
"externalId": "Email",
"externalIdValue": "={{ $json[\"Email\"] }}",
"additionalFields": {
"email": "={{ $json[\"Email\"] }}",
"firstName": "={{ $json[\"First Name\"] }}",
"acconuntId": "={{ $json[\"Account ID\"] }}"
}
},
"typeVersion": 1
},
{
"id": "da75088c-17de-4885-a557-ac2edc84a829",
"name": "Get row(s) in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
-112,
-320
],
"parameters": {
"sheetName": {
"__rl": true,
"mode": "list",
"value": ""
},
"documentId": {
"__rl": true,
"mode": "list",
"value": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "bNNrQVyG0f0LvHLl",
"name": "xavtwl"
}
},
"typeVersion": 4.7
},
{
"id": "c6af3549-df84-4dcc-9db8-306648e614fe",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-816
],
"parameters": {
"color": 5,
"width": 896,
"height": 704,
"content": "# π Part 1: Data Input & Preparation\n\n## Extract company data from Google Sheets and prepare for Salesforce processing.\n\n### Modules:\n- Manual Trigger - Starts the workflow execution\n- Get row(s) in sheet - Reads company data from Google Sheets \n- Search Salesforce accounts - Checks for existing companies\n- Merge existing account data - Combines sheet data with SF search results"
},
"typeVersion": 1
},
{
"id": "9db710b0-ef7a-4263-8d5e-71c513951835",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
512,
-816
],
"parameters": {
"color": 6,
"width": 496,
"height": 704,
"content": "# π Part 2: Smart Routing & Duplicate Detection\n\n## Analyze search results and route companies to appropriate processing paths.\n\n### Logic Flow:\nCompanies are automatically sorted into two paths based on whether they already exist in Salesforce, preventing duplicates while ensuring complete \ndata capture."
},
"typeVersion": 1
},
{
"id": "b9d12003-62b6-427e-8cad-15690eb5593c",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1024,
-816
],
"parameters": {
"color": 4,
"width": 1168,
"height": 704,
"content": "# π Part 3: New Company Processing\n\n## Create new Salesforce accounts for companies not found in the system.\n\n### Modules:\n- Keep new companies - Filters companies not in Salesforce\n- Remove duplicate companies - Eliminates internal duplicates \n- Create Salesforce account - Creates new SF account records\n- Set new account name - Configures account naming\n- Retrieve new company contacts - Gets contact data for new accounts"
},
"typeVersion": 1
},
{
"id": "5c83fdab-2720-4ec2-8b58-70573b61332d",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1024,
-96
],
"parameters": {
"color": 2,
"width": 1168,
"height": 848,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# β
Part 4: Existing Company Processing\n\n## Handle companies that already exist in Salesforce by updating contact information.\n\n### Modules:\n- Account found? - Identifies companies already in Salesforce\n- Set Account ID for existing accounts - Maps existing account IDs\n- Create Salesforce contact - Adds/updates contacts under existing accounts"
},
"typeVersion": 1
},
{
"id": "27f3269e-e2ff-4748-88fd-e2ff31fdece5",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-96
],
"parameters": {
"color": 3,
"width": 1408,
"height": 848,
"content": "# π― Salesforce-Google Sheets Company Sync (Smart Duplicate Prevention)\n## Made by: Xavier Tai\n\n## This workflow automatically syncs company data from Google Sheets to Salesforce with intelligent duplicate prevention and comprehensive contact management.\n\n### β
What You'll Need\nβοΈ Google Sheets with company data (Company Name, Email, Phone, Industry, etc.)\nβοΈ Google Sheets API credentials (OAuth 2.0 authentication configured in n8n)\nβοΈ Salesforce API access (Connected App with Account/Contact create/read permissions)\nβοΈ Salesforce field mapping knowledge (understanding of required vs optional fields for Accounts/Contacts)\nβοΈ n8n instance (cloud or self-hosted with HTTPS)\n\n### β±οΈ Estimated execution time: 15-45 seconds per company\n\n### π§ Security Best Practices\n- Use environment variables for API keys and tokens - never hardcode credentials\n- Limit workflow access to necessary team members only via n8n user permissions \n- Test with small datasets (5-10 companies) before full deployment\n- Process in batches of 25-50 companies maximum to respect API limits\n- Backup existing Salesforce data before running bulk operations\n\n### π¨ Troubleshooting Guide\n- \"Authentication failed\" β Refresh OAuth credentials in n8n connections\n- \"Required field missing\" β Check Salesforce Account/Contact required fields \n- \"Duplicate account created\" β Verify company name exact matching in search logic\n- \"Rate limit exceeded\" β Reduce batch size or add delay nodes between API calls\n- \"Sheet not found\" β Verify Google Sheets file sharing permissions and sheet name\n\n### π Execute workflow\nClick the red \"Execute workflow\" button below to start processing your company data.\nMonitor progress in the execution panel and verify results in Salesforce."
},
"typeVersion": 1
},
{
"id": "f5516431-c30a-4724-8304-655f718015ff",
"name": "Merge existing account data1",
"type": "n8n-nodes-base.merge",
"position": [
336,
-320
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"mergeByFields": {
"values": [
{
"field1": "Company Name",
"field2": "Name"
}
]
}
},
"typeVersion": 3.2
},
{
"id": "877f4623-a915-4f7d-a5a9-22f2b595fb9d",
"name": "Keep new companies",
"type": "n8n-nodes-base.merge",
"position": [
1088,
-448
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"joinMode": "keepNonMatches",
"mergeByFields": {
"values": [
{
"field1": "Company Name",
"field2": "Name"
}
]
},
"outputDataFrom": "input1"
},
"typeVersion": 3.2
},
{
"id": "9e0815e5-7bc5-4254-8030-c0527c665569",
"name": "Retrieve new company contacts",
"type": "n8n-nodes-base.merge",
"position": [
1984,
-448
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"mergeByFields": {
"values": [
{
"field1": "Company Name",
"field2": "Name"
}
]
}
},
"typeVersion": 3.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "9ee52df7-3400-445f-94a6-5b34de249b19",
"connections": {
"Account found?": {
"main": [
[
{
"node": "Set Account ID for existing accounts",
"type": "main",
"index": 0
}
]
]
},
"Keep new companies": {
"main": [
[
{
"node": "Remove duplicate companies",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "Search Salesforce accounts",
"type": "main",
"index": 0
},
{
"node": "Merge existing account data1",
"type": "main",
"index": 0
},
{
"node": "Account found?",
"type": "main",
"index": 0
},
{
"node": "Keep new companies",
"type": "main",
"index": 0
},
{
"node": "Remove duplicate companies",
"type": "main",
"index": 0
},
{
"node": "Retrieve new company contacts",
"type": "main",
"index": 0
},
{
"node": "Create Salesforce contact",
"type": "main",
"index": 0
}
]
]
},
"Set new account name": {
"main": [
[
{
"node": "Retrieve new company contacts",
"type": "main",
"index": 1
}
]
]
},
"On clicking 'execute'": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Create Salesforce account": {
"main": [
[
{
"node": "Set new account name",
"type": "main",
"index": 0
}
]
]
},
"Remove duplicate companies": {
"main": [
[
{
"node": "Create Salesforce account",
"type": "main",
"index": 0
}
]
]
},
"Search Salesforce accounts": {
"main": [
[
{
"node": "Merge existing account data1",
"type": "main",
"index": 1
},
{
"node": "Keep new companies",
"type": "main",
"index": 1
}
]
]
},
"Merge existing account data1": {
"main": [
[
{
"node": "Account found?",
"type": "main",
"index": 0
}
]
]
},
"Retrieve new company contacts": {
"main": [
[
{
"node": "Create Salesforce contact",
"type": "main",
"index": 0
}
]
]
},
"Set Account ID for existing accounts": {
"main": [
[
{
"node": "Create Salesforce contact",
"type": "main",
"index": 0
}
]
]
}
}
}