SyncWith

Export Data in Salesforce

What We’ll Cover

  • How to export salesforce contacts, accounts, opportunities, leads, users, cases
  • How to export directly from Salesforce to Excel, Google Sheets and Airtable
  • How to keep the data sync’d daily
  • Advantages of having your salesforce data exported to another system like Excel
  • Examples of how you can use your

What We’ll Use

  • Google Sheets as a example place to export salesforce data and leverage it
  • SOQL as a means to specify exactly which data we want to export from Salesforce

Want to Export Data without using SOQL?

Don’t worry SOQL isn’t too scary but if you want to export data on a schedule to Excel, Google Sheets or Airtable without needing to write SOQL take a look at our instructions on how to sync salesforce reports to Sheets and Excel. Then you can design your report in Salesforce and sync it daily or even hourly to your platform of choice.

Exporting data from Salesforce - Using SOQL

Assume that it’s really easy to send SOQL to Sealeforce and have it send results back. The first thing we need to know a little bit about is SOQL, then we’ll be in a better position to backup saleforce data or export the data we want.

Quick Video Example

Here’s a quick video showing the whole process front to back before we dive in - it’s easier than you’d think.

Salesforce SOQL Primer

SOQL (Salesforce Object Query Language) is a way to express the data you want from salesforce. Its a fairly simple and robust way to get the data you want

Example Exporting Salesforce Contacts with SOQL

Lets say you want the Name, Phone, and Email for all your contacts we would use the following query:
Select Name, Phone, Email from Contact
That’s it - send this query to Saleforce and you get sent back all your contacts

Time limiting the Data

Often you just want objects returned that are recent, to do that you use the LAST_N_DAYS:N date literal, eg if we want contacts created in the last 90 days we use:
Select Name from Contact where CreatedDate = LAST_N_DAYS:90
Other popular date literals when exporting salesforce data are:
  • LAST_MONTH
  • LAST_90_DAYS
  • NEXT_90_DAYS
  • LAST_WEEK
  • LAST_N_MONTHS:n

Getting all the fields vs just specific ones

Normally you would type Select and then your list of field names. But if you want to get all the fields you can use the Fields() function which can get you all the fields, all the standard fields or all the custom fields using ALL, STANDARD and CUSTOM. The only caveat is that you can only pull a maximum of 200 records when using the fields function. Pulling this together:
  • All the fields for your opportunity object
  • Get the maximum number (200) when using the fields function
Select Fields(ALL) from Contact limit 200

What Tool do I use to Export Salesforce Data

We’ll be using SyncWith to export data from Salesforce. SyncWith can directly and on a schedule export or backup Salesforce data to Google Sheets, Excel and Airtable.
It’s as easy as 1 2 3

1. Pick a Service

notion image
 

2. Configure

notion image

3. Data Exported

notion image
 

Don’t have SyncWith but want to Follow along?

  • SyncWith is an addon for Google Sheets, Excel and Airtable
  • SyncWith allows you to move data from any API including marketing and sales platforms like Hubspot, Salesforce, Google Ads and Facebook
  • ⭐️⭐️⭐️⭐️⭐️ Reviewed by hundreds of businesses
  • Highest rated API add on with over 100,000 installs. Install today.

Install SyncWith

Salesforce Export Data

We’ll run through 5 examples
  • Export salesforce contacts
  • Export salesforce accounts
  • Export salesforce oppotunities
  • Export salesforce leads

Exporting Salesforce Contacts

Basic:
SELECT Name, Title, Email, Account.Name, Phone, MobilePHone, Department, LeadSource, Description, Birthdate FROM Contact
notion image
Contacts just from United OIl & Gas Corp.
//How to export salesforce contacts from a specific account SELECT Name, Title, Email, Account.Name, Phone, MobilePHone, Department, LeadSource, Description, Birthdate FROM Contact WHERE Account.Name = 'United Oil & Gas Corp.'
notion image

Exporting Salesforce Leads

Basic:
SELECT Name, Title, Company, Status, Rating, AnnualRevenue, Email, IsConverted FROM lead
notion image
Maybe we only want leads that are open and not contacted so we can see if reps are staying on top of the new leads
SELECT Name, Title, Company, Status, Rating, AnnualRevenue, Email, IsConverted FROM lead WHERE status = 'Open - Not Contacted'
notion image
But maybe we want to understand which leads are still non Contacted too long after they were created, eg the lead is over a week old and we still haven’t contacted in 14days since being created. We’ll also add the field CreatedDate and Owner.Name so we can see how stale the leads are and who the owner is, we’ll remove Ratting and AnnualRevenue since at this stage they’ll be blank
SELECT CreatedDate, Name, Title, Company, Status, Email, IsConverted, Owner.Name FROM lead WHERE status = 'Open - Not Contacted' and CreatedDate < LAST_N_DAYS:14
notion image
We could even add a helper column in the spreadsheet to show how old they are:
notion image

Exporting Salesforce Opportunities

Basic:
SELECT Name, Account.Name, StageName, Amount, ExpectedRevenue,CloseDate FROM Opportunity
notion image
Say we just want to export new opportunities, eg a screen that always shows the opportunities from the last month ordered by newest first:
SELECT CreatedDate,Name,Account.Name, StageName, Amount, ExpectedRevenue,CloseDate FROM Opportunity WHERE CreatedDate = LAST_N_DAYS:14 ORDER BY CreatedDate desc
Or perhaps we only want to export salesforce opportunities that are in Qualification or Closed Won, in that case we us the in operator in SOQL and a comma separated list of values that are valid
SELECT CreatedDate,Name,Account.Name, StageName, Amount, ExpectedRevenue,CloseDate FROM Opportunity WHERE StageName In ('Qualification','Closed Won')
notion image

Exporting Salesforce Accounts

Basic:
SELECT Name, Owner.Name, Industry, AnnualRevenue, Site, Rating, LastActivityDate FROM Account
notion image
Lets say you only want to look at Accounts that are warm
SELECT Name, Owner.Name, Industry, AnnualRevenue, Site, Rating, LastActivityDate FROM Account WHERE Rating = 'Warm'

Backing up Your Salesforce Data Daily

If you’re running salesforce and you want to have a daily backup of your salesforce data, you can setup a daily sync from Salesforce to Google Sheets. You do this by simply turning on a refresh schedule.

Setting up a Backup Schedule

Create a New Report

notion image

Set a Refresh Schedule

notion image

Why Export your Data to Another System

  • Having the data in a spreadsheet makes it more portable if you want to switch to another CRM provider
  • Having data in a online tool like Sheets or Excel means you can collaborate and share reports with folks without needing to give them salesforce licenses
  • Marry the data with other information coming in such as marketing, lead or financial information you can’t easily bring into salesforce

Examples of Using your Salesforce Export Data in a Spreadsheet

  1. Calculate Salesperson commissions more easily using formulas and pivots
  1. Monitor new leads coming in (you can even setup hourly syncs)
  1. Better bulk editing of accounts and other objects before uploading back to salesforce