Opening Problem Statement ⚙️
Meet Tom, a busy sales operations manager who oversees hundreds of company accounts in Salesforce. Every week, his team collates new lead companies and contact details in a shared Google Sheet. However, manually checking for companies already in Salesforce, avoiding duplicates, creating new accounts, and then adding or updating contacts has become a nightmare. It wastes hours each week, increases errors, and risks missing valuable leads.
Tom often spends 3–4 hours every week cross-referencing thousands of rows in Google Sheets with Salesforce data, just to avoid duplicate entries and keep the CRM up-to-date. Mistakes in account matching cause data inconsistencies leading to missed follow-ups and lost sales opportunities.
What if Tom could automate this tedious, error-prone process? With the power of n8n integration between Google Sheets and Salesforce, this exact task can be automated, freeing up time and improving data accuracy.
What This Automation Does 🔑
This n8n workflow streamlines syncing new company accounts and their contacts from a Google Sheet into Salesforce automatically.
- Reads company and contact data from a Google Sheet 📊
- Searches Salesforce for existing accounts by company name to avoid duplicates 🔍
- Keeps only new companies not yet in Salesforce for account creation ✨
- Creates new Salesforce accounts for these new companies 💼
- Updates and merges existing account data for already present companies 🔄
- Creates or updates contacts for both new and existing accounts with proper linking 🧑💼
Thanks to this automation, Tom saves at least 4 hours weekly and reduces human errors drastically, improving data quality and sales follow-up efficiency.
Prerequisites ⚙️
- n8n automation platform account (self-hosted or cloud-based) 🔌
- Google Sheets account with access to the sheet containing company and contact data 📊
- Salesforce account with API access and OAuth credentials 🔐
- Configured OAuth credentials in n8n for Google Sheets and Salesforce 🔑
Step-by-Step Guide to Building This Workflow ✏️
Step 1: Start with a Manual Trigger node
In n8n, click quot;Add Nodequot; 1Manual Triggerquot; and place it on the canvas.
This node allows you to manually start the workflow for testing.
Expected: When you click quot;Execute Workflowquot;, the flow will start.
Common mistake: Forgetting to connect the trigger node downstream.
Step 2: Add a Google Sheets node to read data from your spreadsheet
Click quot;Add Nodequot; → Search for quot;Google Sheetsquot; → Select quot;Google Sheetsquot;.
Set the quot;Operationquot; to read rows from your sheet.
Enter your specific Sheet ID (found in the URL of your Google Sheet).
Example: 1cz-4tVi7Nn3j1gh147hROq9l6S4ta06sMfhm2AAI6js
Choose the right sheet tab if necessary.
Expected: The node pulls all rows of company and contact data.
Common mistake: Not setting up Google OAuth credentials or insufficient sheet permissions.
Step 3: Search Salesforce for existing accounts matching each company
Add a quot;Salesforcequot; node → Select quot;Searchquot; resource.
Use the SOQL query to find accounts by company name:
SELECT id, Name FROM Account WHERE Name = '{{Company Name}}'
In this workflow, the query dynamically replaces ‘Company Name’ from each row, properly escaping apostrophes.
Expected: Each company is checked against Salesforce accounts.
Common mistake: Incorrect query syntax or failing to escape special characters.
Step 4: Split the data into new companies and existing accounts
Use the quot;Mergequot; node in quot;removeKeyMatchesquot; mode to keep only new companies without matching Salesforce accounts.
Conversely, use another quot;Mergequot; node in quot;mergeByKeyquot; mode to combine existing company details from the sheet with Salesforce data.
Expected: Clear separation of new vs existing companies.
Common mistake: Wrong key property names causing no matches.
Step 5: Remove duplicate companies from the new companies list
Add an quot;Item Listsquot; node set to quot;removeDuplicatesquot; based on the ‘Company Name’ field.
Expected: Only unique new companies remain for account creation.
Common mistake: Not specifying the correct field name for duplicates.
Step 6: Create new Salesforce accounts for each new company
Add a quot;Salesforcequot; node in quot;accountquot; resource mode.
Map the quot;Company Namequot; field to the account quot;Namequot; property.
Expected: New accounts created in Salesforce.
Common mistake: API permission errors or missing required account fields.
Step 7: Assign new account IDs to the newly created accounts
Use a quot;Setquot; node to assign the quot;idquot; from created account response and keep the quot;Company Namequot;.
expected outcome: Each new company record now carries its Salesforce account ID.
Common mistake: Not using the keepOnlySet option correctly.
Step 8: Merge contacts for new accounts and create or update them in Salesforce
Use a quot;Mergequot; node to link contact data to the respective accounts by company name.
Add a quot;Salesforcequot; node in quot;contactquot; resource and quot;upsertquot; operation.
Map contact fields quot;Last Namequot;, quot;Emailquot;, quot;First Namequot;, and link to quot;Account IDquot;.
Expected: Contacts are properly created or updated linked to accounts.
Common mistake: Misspelling the account ID field as in this case quot;acconuntIdquot; should be quot;AccountIdquot; (this workflow has a typo to be corrected).
Step 9: Update existing accounts and their contacts
Use a conditional quot;Ifquot; node to check if an account ID exists.
Rename the quot;Idquot; field to quot;Account IDquot; for clarity.
Create or upsert contacts for existing accounts similarly as new ones.
Expected: Existing Salesforce accounts and their contacts are kept up-to-date.
Common mistake: Missing the update path or incorrect field renaming.
Customizations ✏️
- Change matching criteria: In the quot;Search Salesforce accountsquot; node, modify the SOQL query to match accounts using other fields such as VAT number or ID instead of company name.
This helps avoid errors due to company name variations. - Send notifications for new account creation: Add an quot;Email Sendquot; or quot;Slackquot; node after account creation to alert your sales team.
This increases visibility and reduces follow-up delays. - Handle duplicates in contacts: Add logic using quot;Item Listsquot; node to remove duplicate contacts based on email.
Ensures no multiple contacts for the same email are created.
Troubleshooting 🔧
Problem: “Salesforce query returns empty results for existing companies”
Cause: Incorrect SOQL syntax or mismatch in company name formatting.
Solution: Verify SOQL query syntax, ensure proper escaping of special characters, and test with sample company names.
Problem: “New Salesforce accounts not created”
Cause: Insufficient API permissions or missing required fields.
Solution: Check Salesforce API user’s permissions, ensure required account fields like Name are provided, and check authentication tokens.
Pre-Production Checklist ✅
- Ensure Google Sheets OAuth credentials are correctly configured and have read access.
- Confirm Salesforce OAuth credentials have create and update permissions on accounts and contacts.
- Test the manual trigger to confirm workflow runs end-to-end without errors.
- Validate the SOQL query returns expected account data for known companies.
- Backup your Salesforce data before running in production to enable rollback if needed.
Deployment Guide
Activate the workflow by clicking the quot;Activatequot; button in n8n.
Set a schedule trigger later if you want this to run periodically.
Monitor the execution logs via the n8n dashboard for any errors.
Set alerting on failures using built-in n8n notifications or integrate with external tools.
FAQs
Can I use Excel instead of Google Sheets here?
Currently, this workflow uses the Google Sheets node which requires a Google Sheet. For Excel, you would need additional nodes or use an external connector.
Does this consume Salesforce API credits?
Yes, each create, update, or query consumes API calls. Plan your automation accordingly to avoid limits.
Is my data safe?
Data is handled securely via OAuth and your own n8n environment. Ensure your credentials are stored safely.
Conclusion
With this detailed workflow, you’ve automated the tedious process Tom faced: syncing new company accounts and contacts from Google Sheets into Salesforce without duplicates or errors.
You save hours every week otherwise spent on manual cross-checking, drastically reduce data errors, and improve team productivity.
Next automation ideas to try:
– Auto-assign leads from new Salesforce accounts to sales reps
– Sync Salesforce opportunities to Google Sheets for reporting
– Send Slack alerts for high-priority account creations
Get started today and make your sales process smarter and faster!