Import Excel Spreadsheet to Salesforce Accounts and Contacts
Overview
This workflow automates the process of importing company and contact data from an Excel spreadsheet into Salesforce. It downloads a remote Excel file, parses its contents, and then intelligently creates or updates Salesforce Accounts and Contacts. The workflow handles deduplication by checking for existing Accounts by name and using email as the external ID for Contacts (upsert). This is particularly useful for sales teams, marketers, or data administrators who regularly receive lead or account lists in spreadsheet format and need to sync them into Salesforce without manual data entry.
Node-by-Node Breakdown
-
On clicking 'execute' (Manual Trigger) — No auth. This is a manual trigger node that starts the workflow when the user clicks the 'Execute Workflow' button in the n8n editor. Useful for testing or on-demand imports.
-
Download file (HTTP Request) — No auth. Downloads an Excel file from a hardcoded URL (
https://static.thomasmartens.eu/n8n/Excel-File-to-Salesforce.xlsx). The response format is set to 'file' to handle binary data. You can replace this URL with your own file source (e.g., Google Drive, Dropbox, or an internal server). -
Spreadsheet File (Spreadsheet File) — No auth. Parses the downloaded binary file into structured JSON data. It reads the first sheet by default and outputs each row as a separate item with column headers as property names (e.g., "Company Name", "First Name", "Last Name", "Email").
-
Search Salesforce accounts (Salesforce) — OAuth2 or Salesforce Credentials. Executes a SOQL query to find existing Accounts where the Name matches the "Company Name" from the spreadsheet. The query uses a dynamic expression that escapes single quotes to prevent injection:
SELECT id, Name FROM Account WHERE Name = '{{$json["Company Name"].replace(/'/g, '\\\'')}}'. -
Keep new companies (Merge) — No auth. Uses "Remove Key Matches" mode to filter out companies that already exist in Salesforce. It compares the "Company Name" property (from spreadsheet) against the "Name" property (from Salesforce query results). Only companies not found in Salesforce pass through.
-
Merge existing account data (Merge) — No auth. Uses "Merge By Key" mode to join the spreadsheet data with Salesforce query results based on matching "Company Name" / "Name". This creates combined items containing both spreadsheet fields and Salesforce Account IDs for existing companies.
-
Account found? (IF) — No auth. Checks if the merged data contains a Salesforce Account ID (the
Idfield). IfIdis not empty, the account exists; if empty, it's a new company. This splits the workflow into two paths. -
Remove duplicate companies (Item Lists) — No auth. Removes duplicate rows from the "new companies" branch based on the "Company Name" field. This ensures no duplicate Account creation attempts.
-
Set Account ID for existing accounts (Rename Keys) — No auth. Renames the Salesforce
Idfield toAccount IDfor clarity and consistency in downstream nodes. -
Set new account name (Set) — No auth. Creates a new object with only two fields:
id(from the spreadsheet row) andName(the company name from the deduplicated list). This prepares data for creating a new Salesforce Account. -
Create Salesforce account (Salesforce) — OAuth2 or Salesforce Credentials. Creates a new Account record in Salesforce using the "Company Name" as the Account name. Additional fields can be added via the
additionalFieldsparameter. -
Retrieve new company contacts (Merge) — No auth. Merges the newly created Account's data (including the new Salesforce Account ID) back with the original spreadsheet contact data, using "Company Name" as the join key.
-
Create Salesforce contact (Salesforce) — OAuth2 or Salesforce Credentials. Creates or updates (upsert) a Contact record in Salesforce. Uses
Emailas the external ID for upsert logic. Maps spreadsheet fields:First Name,Last Name,Email, and links the contact to the Account viaAccount ID.
Setup Instructions
- Salesforce Account: You need a Salesforce org (Developer, Enterprise, or Unlimited Edition) with API access enabled.
- Salesforce Credentials in n8n: Create a new Salesforce credential in n8n. You'll need to set up a Connected App in Salesforce with OAuth2 settings. Follow n8n's Salesforce documentation for detailed steps.
- Spreadsheet File: The workflow currently downloads a sample Excel file from a public URL. Replace the URL in the Download file node with your own file. Ensure the spreadsheet has columns named exactly:
Company Name,First Name,Last Name,Email. You can also replace the HTTP Request node with a different trigger (e.g., email attachment, Google Sheets, local file read). - Permissions: The Salesforce user associated with the credentials must have permissions to create/update Accounts and Contacts.
Use Cases and Variations
- Lead Import: Adapt the workflow to create Salesforce Leads instead of Accounts/Contacts by changing the Salesforce resource type and field mappings.
- Scheduled Imports: Replace the Manual Trigger with a Cron/Schedule trigger to run daily or weekly.
- Email Attachment: Instead of HTTP download, use an Email (IMAP) node to read spreadsheet attachments from a specific inbox.
- Google Sheets Source: Replace the HTTP Request + Spreadsheet File nodes with a Google Sheets node to read data directly from a sheet.
- Data Enrichment: Add an HTTP Request node to enrich company data (e.g., Clearbit, Hunter.io) before creating Salesforce records.
- Error Handling: Add error workflows or notification nodes (Slack, email) to alert when imports fail or when duplicates are detected.
Workflow JSON
{
"nodes": [
{
"id": "76f6b074-32a5-4419-aa0f-80505b3a31ad",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
20,
240
],
"parameters": {},
"typeVersion": 1
},
{
"id": "42289f01-3af9-4bc3-babb-54b983de7e77",
"name": "Search Salesforce accounts",
"type": "n8n-nodes-base.salesforce",
"position": [
680,
240
],
"parameters": {
"query": "=SELECT id, Name FROM Account WHERE Name = '{{$json[\"Company Name\"].replace(/'/g, '\\\\\\'')}}'",
"resource": "search"
},
"credentials": {
"salesforceOAuth2Api": {
"id": "40",
"name": "Salesforce account"
}
},
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "954ef43f-4dc1-4955-9c56-c5d11bcd5d6e",
"name": "Keep new companies",
"type": "n8n-nodes-base.merge",
"position": [
900,
40
],
"parameters": {
"mode": "removeKeyMatches",
"propertyName1": "Company Name",
"propertyName2": "Name"
},
"typeVersion": 1
},
{
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
Sync Calendly Invitees to Mautic Contacts
Overview This workflow automatically creates or updates a contact in Mautic whenever a new invitee schedules an event through Calendly. It eliminates manual data entry, ensures your CRM stays current, and helps you follow up with leads immediately after they book a call. How It Works The workflow runs in two main steps: first, it listens for a new Calendly event; second, it uses the invitee's email and name to either create a new contact in Mautic or update an existing one if the email already exists. Nodes and Their Roles On new event () – OAuth2 – Listens for the event from Calendly. When someone schedules an event, this node fires with the invitee's email, name, and other details. - Parameters: set to Create/update contact () – Basic Auth – Receives the trigger data and sends a request to Mautic to create or update a contact. It maps the invitee's email (from the trigger's ) and first name (from ). If a contact with that email already exists in Mautic, its first name is overwritten. - Parameters: = , = Error Handler () – No auth – Catches any execution errors and stops the workflow with a user-defined message, preventing silent failures. Setup Instructions Calendly account: You need a Calendly account with OAuth access. In n8n, create a Calendly OAuth2 credential (Client ID and Client Secret from your Calendly developer app). Mautic instance: You need a running Mautic instance with API access. In n8n, create a Mautic credential with the instance URL, your Mautic username, and password (Basic Auth). Workflow activation: Set the Calendly trigger to “Webhook” mode and use the provided webhook URL in your Calendly webhook settings. Activate the workflow. Use Cases & Variations Sales follow‑up: Automatically add new leads from demo bookings into Mautic for immediate email sequences. Marketing automation: Combine with Mautic segments and campaigns to send tailored content based on event type. Other CRMs: Replace the Mautic node with Salesforce, HubSpot, or any other CRM node supported by n8n. Enrichment: Add an HTTP Request node to look up company details before creating the contact.
Import Leads from Google Drive to Pipedrive with Duplicate Detection
This workflow automatically imports new leads from a spreadsheet file (CSV or Excel) placed in a specific Google Drive folder into Pipedrive. It checks for existing contacts by email to avoid duplicates, then creates an organization, person, lead, and note for each new entry. Ideal for sales teams that receive lead lists via shared files and want to streamline CRM updates. Workflow Steps Google Drive Trigger (OAuth2) — Polls a specific Google Drive folder every minute for newly created files. Configured to watch the folder with ID . Google Drive (OAuth2) — Downloads the file identified by the trigger using its . Spreadsheet File (No auth) — Parses the downloaded file (CSV/Excel) into JSON rows. No additional parameters set. Pipedrive (OAuth2 or API Key) — Fetches all existing leads from Pipedrive ( operation). Runs once per workflow execution. IF (No auth) — For each lead, checks if is greater than 0 (i.e., the lead is linked to a person). If true, proceeds to fetch the person details. Pipedrive1 (OAuth2 or API Key) — Retrieves the person record using the from the lead. Merge (No auth) — Combines the spreadsheet rows (Input 0) with the fetched person data (Input 1). Uses mode: it removes rows from the spreadsheet where the matches the from Pipedrive persons, effectively filtering out duplicates. Set (No auth) — Extracts and renames fields: (from ), (concatenation of and ), (from ), (from ). Only these fields are kept. Create Organization (OAuth2 or API Key) — Creates a new Pipedrive organization with the name set to the value. Create Person (OAuth2 or API Key) — Creates a person with the and from the Set node, linked to the newly created organization (). Also sets a custom property (likely "Lead Source") to . Create Lead (OAuth2 or API Key) — Creates a lead with title , associated with the organization and person. Owner ID is hardcoded to . Create Note (OAuth2 or API Key) — Adds a note to the lead containing the company size. Setup Instructions Google Drive: You need a Google account with access to the folder where lead files will be uploaded. In n8n, create a Google Drive OAuth2 credential (or use a service account). Pipedrive: You need a Pipedrive account. Create an API token or OAuth2 credential in n8n. The workflow uses a hardcoded owner ID () — replace it with your own user ID from Pipedrive. Spreadsheet Format: The file must have columns named , , , , . Adjust the Set node if your column names differ. Folder ID: The trigger watches a specific folder. Replace the folder ID with your own Google Drive folder ID. Use Cases & Variations Lead Import from CSV/Excel: Perfect for marketing teams that receive lead lists from events, webinars, or purchased lists. Deduplication: The merge step prevents creating duplicate contacts by email. You could extend it to check other fields (e.g., phone number). Custom Fields: The Create Person node sets a custom property. Modify the property ID and value to match your Pipedrive setup. Alternative Triggers: Replace the Google Drive Trigger with an email trigger (e.g., Gmail) to process leads sent as attachments. Error Handling: Add error workflows or notifications (e.g., Slack) if a file fails to parse or a Pipedrive API call fails.
Automated Birthday & Anniversary Wishes from Airtable via Gmail
Overview This workflow automatically sends personalized birthday and anniversary wishes to your contacts (clients, employees, or members) every day at 8 AM. It checks an Airtable base for any records where today matches the person's date of birth or anniversary, then sends a warm email via Gmail. Perfect for maintaining relationships without manual effort. How It Works Schedule Trigger — Runs the workflow daily at 8 AM (no auth) Search Client — Queries Airtable for records where the or field matches today's month and day (API Key auth) Check Available Dates — An IF node that verifies the record actually has a date in either field (no auth) No Operation, do nothing — A placeholder for records that don't have a date (false branch) Generate Subject & Body — A Code node that creates a custom subject line and message depending on whether it's a birthday or anniversary (no auth) Send Emails — Sends the email to the person's address using Gmail (OAuth2) Node Details Schedule Trigger (No auth) — Configured to trigger at 8:00 AM every day. You can adjust the hour in the node settings. Search Client (API Key auth) — Uses an Airtable credential. The filter formula finds all records where either date matches today. Check Available Dates (No auth) — Two conditions combined with AND: is not empty AND is not empty. This ensures the record has at least one date to work with. Records that pass go to the true branch; others go to the false branch (No Operation). Generate Subject & Body (No auth) — JavaScript code that extracts the person's name, email, and dates. It compares today's month-day to the date fields and sets a subject like "🎂 Happy Birthday!" or "💍 Happy Anniversary!" along with a friendly message. The output includes the original data plus , , and . Send Emails (OAuth2) — Uses a Gmail credential. Sends a plain text email to the recipient's email address with the generated subject and message. The option is disabled to keep the email clean. Setup Instructions Airtable — Create a base with a table containing at least these fields: (text), (email), (date), (date). Populate with your contacts. Airtable Credential — In n8n, create an Airtable credential using your API key (get it from your Airtable account settings). Gmail Credential — Create a Gmail OAuth2 credential in n8n. You'll need a Google Cloud project with the Gmail API enabled and the necessary redirect URIs configured. Update Node Parameters — Open the Search Client node and select your Airtable base and table. The filter formula is already set; you may need to adjust field names if they differ. Activate Workflow — Once everything is connected, toggle the workflow to active. It will run daily at 8 AM. Use Cases & Variations Employee Recognition — Replace the email with a Slack message to a company channel for public recognition. Client Appreciation — Add a discount code or special offer in the email body. Multi‑channel — Combine with SMS (e.g., Twilio) for a more personal touch. Different Triggers — Change the schedule to run weekly or on specific days. Custom Templates — Modify the Code node to pull from a Google Doc or use HTML email formatting. This workflow is easily adaptable to any scenario where you want to automatically celebrate important dates with your network.