Sync Microsoft Excel Contacts to Salesforce Accounts and Contacts

Overview

This workflow automates the process of importing company and contact data from a Microsoft Excel worksheet into Salesforce. It reads a list of companies and contacts from Excel, checks if each company already exists as a Salesforce Account, creates new Accounts for companies that don't exist, and then creates or updates Contacts under the correct Account. This is ideal for sales teams, marketers, or data administrators who regularly receive lead lists in Excel and need to keep Salesforce CRM up to date without manual data entry.

The workflow handles deduplication, matching existing accounts, and upserting contacts by email to avoid duplicates. It runs on manual trigger, making it suitable for on-demand imports after uploading a new Excel file.

Node-by-Node Breakdown

  1. On clicking 'execute' (Manual Trigger — No auth) — This is the workflow starter. It runs only when a user clicks the "Execute Workflow" button in the n8n editor. No authentication required.

  2. Microsoft Excel (Microsoft Excel — OAuth2) — Reads the content of a specific worksheet from a Microsoft Excel workbook. Configured to get the range A1:E11 from workbook CA5C20CA5A0862D9!1122 and worksheet {00000000-0001-0000-0000-000000000000}. This node expects the Excel data to have columns like "Company Name", "First Name", "Last Name", "Email", etc.

  3. Search Salesforce accounts (Salesforce — OAuth2) — Runs a SOQL query against Salesforce to find an existing Account with the same name as the company from the Excel row. The query uses a dynamic expression: =SELECT id, Name FROM Account WHERE Name = '{{$json["Company Name"].replace(/'/g, '\\\'')}}'. This escapes single quotes in company names to prevent SOQL injection.

  4. Keep new companies (Merge — No auth) — Uses "Remove Key Matches" mode to compare the Excel data (propertyName1: "Company Name") with the Salesforce search results (propertyName2: "Name"). It outputs only the companies from Excel that do NOT have a matching Salesforce Account.

  5. Merge existing account data (Merge — No auth) — Uses "Merge By Key" mode to join the Excel data with the Salesforce search results on "Company Name" / "Name". This creates a combined dataset for companies that already exist in Salesforce.

  6. Account found? (IF — No auth) — Checks if the merged data from the previous step contains a non-empty Id field (the Salesforce Account ID). If Id is not empty, the account exists; if empty, it means no match was found.

  7. Remove duplicate companies (Item Lists — No auth) — Removes duplicate rows from the "new companies" list based on the "Company Name" field. This ensures only unique new companies are processed.

  8. Set Account ID for existing accounts (Rename Keys — No auth) — Renames the Id field from Salesforce to Account ID so it can be used later when creating contacts under the correct account.

  9. Create Salesforce account (Salesforce — OAuth2) — Creates a new Salesforce Account record using the company name from the Excel data. The name is set dynamically: ={{ $json["Company Name"] }}.

  10. Set new account name (Set — No auth) — Prepares the data for the next merge by setting the id and Name fields. It uses the id from the newly created Salesforce Account and the Company Name from the deduplicated list.

  11. Retrieve new company contacts (Merge — No auth) — Merges the newly created Account data (with its Salesforce ID) back with the original Excel contact data, matching on "Company Name" / "Name". This attaches the correct Account ID to each contact.

  12. Create Salesforce contact (Salesforce — OAuth2) — Creates or updates (upserts) a Salesforce Contact record. It uses Email as the external ID for upserting, so if a contact with that email already exists, it will be updated. The contact's first name, last name, email, and Account ID are set from the merged data.

Setup Instructions

To use this workflow, you need:

  1. Microsoft Excel account with OAuth2 access. You must authenticate n8n with your Microsoft account that has access to the workbook. The workbook ID and worksheet ID are hardcoded — you'll need to replace these with your own workbook and worksheet IDs. To find them, use the Microsoft Graph API or the n8n Microsoft Excel node's "Get Worksheets" operation.

  2. Salesforce account with OAuth2 credentials. You need to create a Connected App in Salesforce and configure OAuth2 in n8n. The workflow requires permissions to read and write Accounts and Contacts.

  3. Excel file structure: The Excel worksheet must have columns named exactly as used in the workflow: "Company Name", "First Name", "Last Name", "Email". The range is set to A1:E11 — adjust this to match your actual data range.

To configure:

  • Replace the Microsoft Excel node's workbook and worksheet IDs with your own.
  • Ensure your Salesforce credentials are set up in n8n credentials.
  • Adjust the Excel range if your data has more rows or columns.

Use Cases and Variations

  • Marketing lead import: Import a list of trade show leads from Excel into Salesforce, automatically creating accounts and contacts.
  • Sales prospecting: Weekly upload of curated prospect lists from Excel to Salesforce for sales team follow-up.
  • Data migration: Migrate legacy CRM data stored in Excel into Salesforce.
  • Variation: Replace Microsoft Excel with Google Sheets by using the Google Sheets node instead. The rest of the workflow logic remains the same.
  • Variation: Add an email notification (e.g., via SendGrid or SMTP) after the import completes to alert the team.
  • Variation: Add error handling with an IF node to log failed imports to a separate sheet or send alerts.
  • Variation: Schedule the workflow to run daily using a Schedule Trigger, assuming the Excel file is updated automatically.
12 nodesmanual triggerCRM
SalesforceMergeIFItem ListsRename KeysSetMicrosoft Excel

Workflow JSON

{
  "nodes": [
    {
      "id": "e67d505c-20a3-4318-ba6b-d73db55e88e4",
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        240,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "172d7c44-c488-4523-a0ad-1c903374c3e8",
      "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": "ae559728-f82e-44d6-8cfe-512151ee6867",
      "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

  1. 1Copy the workflow JSON above using the Copy Workflow JSON button.
  2. 2Open your n8n instance and go to Workflows.
  3. 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.

4 nodes

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.

12 nodes

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.

6 nodes

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.