How to Sync Salesforce with Google Sheets Using n8n (One-Way and Two-Way)

Sales teams live in Salesforce. Everyone else (finance, ops, the boss who wants a quick look) lives in Google Sheets. Exporting a report every morning and pasting it into a sheet gets old fast. In this tutorial you’ll use n8n to keep Salesforce and Google Sheets in sync automatically: one way, the other way, and both ways without an endless loop.

What you’ll build

  • Sync 1: Salesforce → Google Sheets. Every hour, new and changed records are copied into a sheet. Existing rows are updated, never duplicated.
  • Sync 2: Google Sheets → Salesforce. When someone adds or edits a row, n8n creates or updates the matching Salesforce record and writes the Salesforce ID back to the sheet.
  • Two-way sync: both workflows running together, with a simple check that stops them from triggering each other forever.

The examples use Leads, but the same pattern works for Contacts, Accounts, Opportunities and Custom Objects.

Before you start

  • An n8n instance (self-hosted or n8n Cloud).
  • A Salesforce OAuth2 credential in n8n. If you haven’t set one up yet, follow Step 1 of our n8n Salesforce tutorial.
  • A Google Sheets OAuth2 credential in n8n (sign in with Google when you add the credential).

Step 1: Set up the sheet

Create a new Google Sheet with a tab called Leads and these headers in row 1:

Salesforce Id | First Name | Last Name | Company | Email | Phone | Status | Last Modified

The Salesforce Id column is the key. It’s how n8n knows which row belongs to which record, so the sync can update rows instead of adding duplicates. Leave it empty for new rows you type in by hand; n8n will fill it in.

Sync 1: Salesforce → Google Sheets

Schedule Trigger (every hour)
      ↓
Salesforce: Search (SOQL, changed in the last 2 hours)
      ↓
Google Sheets: Append or Update Row (match on Salesforce Id)
  1. Add a Schedule Trigger set to run every hour.
  2. Add a Salesforce node: Resource Search, Operation Query. Paste this SOQL:
    SELECT Id, FirstName, LastName, Company, Email, Phone, Status, LastModifiedDate
    FROM Lead
    WHERE LastModifiedDate >= {{ $now.minus({ hours: 2 }).toUTC().toISO({ suppressMilliseconds: true }) }}
    ORDER BY LastModifiedDate ASC

    Two hours of lookback on an hourly schedule means nothing slips through if a run is late. The overlap is harmless because the next step updates rows instead of adding them. Note that SOQL date values are written without quotes.

  3. Add a Google Sheets node: Operation Append or Update Row. Pick your spreadsheet and the Leads tab, set Column to match on to Salesforce Id, and map the fields:
    • Salesforce Id: {{ $json.Id }}
    • First Name: {{ $json.FirstName }}
    • Last Name: {{ $json.LastName }}
    • Company: {{ $json.Company }}
    • Email: {{ $json.Email }}
    • Phone: {{ $json.Phone }}
    • Status: {{ $json.Status }}
    • Last Modified: {{ $json.LastModifiedDate }}

First run: to load all your existing leads once, temporarily remove the WHERE line, run the workflow manually, then put it back.

Need a weekly snapshot instead of a live copy? See Workflow 4 in the n8n Salesforce tutorial, which clears the sheet and writes a fresh pipeline report every Monday.

Sync 2: Google Sheets → Salesforce

Google Sheets Trigger (Row Added or Updated)
      ↓
IF Salesforce Id is empty
   ↓ true                         ↓ false
Salesforce: Lead → Create      Salesforce: Lead → Update
   ↓
Google Sheets: Update Row (write the new Id back)
  1. Add a Google Sheets Trigger, pick the same spreadsheet and tab, and set the event to Row Added or Updated. It checks the sheet on a polling interval (every minute by default).
  2. Add an IF node with the condition {{ $json['Salesforce Id'] }} is empty.
  3. True branch (new row): add a Salesforce node: Lead → Create. Salesforce requires Last Name and Company:
    • Last Name: {{ $json['Last Name'] }}
    • Company: {{ $json.Company || 'Unknown' }}
    • Additional Fields: First Name, Email, Phone, Status
  4. After the Create node, add a Google Sheets node: Operation Update Row, matching on row_number with the value {{ $('Google Sheets Trigger').item.json.row_number }}, and set Salesforce Id to {{ $json.id }}. Now the row is linked to its record.
  5. False branch (existing row): add a Salesforce node: Lead → Update, with Lead ID {{ $json['Salesforce Id'] }} and the fields you allow people to edit from the sheet.

Tip: add data validation (a dropdown) to the Status column with your exact Salesforce picklist values, such as Open – Not Contacted and Working – Contacted. A typo in a picklist value is the most common reason an update fails.

Making it two-way without a loop

Run both workflows together and they can feed each other forever: Sync 1 updates a row, the trigger in Sync 2 sees the change and updates Salesforce, which changes LastModifiedDate, so Sync 1 picks the record up again, and so on.

The fix is to only push real changes. In Sync 2’s false branch, before the Update node:

  1. Add a Salesforce node: Lead → Get, using the Salesforce Id from the row.
  2. Add an IF node that compares the sheet values with the Salesforce values:
    {{ $('Google Sheets Trigger').item.json.Email !== $json.Email
    || $('Google Sheets Trigger').item.json.Phone !== $json.Phone
    || $('Google Sheets Trigger').item.json.Status !== $json.Status }}

    Set the condition to is true (Boolean). Add the other fields you sync the same way.

  3. Only send the true output to the Update node. If nothing changed, the run stops there.

When Sync 1 copies a record into the sheet, the values already match Salesforce, so Sync 2 finds no difference and does nothing. The loop is broken.

Pick a winner for conflicts. If someone edits the same lead in both places within the same hour, the last sync to run wins. For most teams the simplest rule is: Salesforce is the source of truth, and the sheet may only edit a few columns (for example Phone and Status). Leave the other columns out of Sync 2 entirely.

Limits to keep in mind

  • Google Sheets API: about 60 read or write requests per minute per user. For big batches, turn on Retry On Fail in the node settings, or add a Loop Over Items node with a short Wait between batches.
  • Salesforce API: every org has a daily API request limit. The SOQL query costs one request no matter how many rows it returns, so the hourly pull is cheap. Sync 2 uses one or two requests per edited row.
  • Sheet size: a spreadsheet holds up to 10 million cells. For hundreds of thousands of records, use a database (like Supabase or Postgres) and keep the sheet for summaries.

Troubleshooting

  • Duplicate rows: check that Column to match on is set to Salesforce Id and that the header in the sheet is spelled exactly the same.
  • REQUIRED_FIELD_MISSING: the row has no Last Name or Company. Make both columns required in your sheet, or use a fallback like 'Unknown'.
  • INVALID_FIELD or a bad picklist value: the field name or value doesn’t match Salesforce exactly. Check the API names in Setup → Object Manager.
  • The trigger doesn’t fire: the Google Sheets Trigger only runs while the workflow is active, and only sees changes after it was activated.
  • Expired Salesforce connection: make sure your Salesforce app has the refresh_token, offline_access scope so n8n can stay signed in.

Wrapping up

With two small workflows, Salesforce and Google Sheets stay in step without anyone exporting a report again. Start with Sync 1 so the sheet is always current, add Sync 2 once your team wants to edit from the sheet, and keep the change check in place so the two never chase each other.

Want to see it built step by step? Watch the walkthroughs on our YouTube channel, Node & Volt.

Leave a Comment