Search API Connector Documentation
Import Salesforce Data into Google Sheets
In this guide, we’ll walk through how to import Salesforce data directly into Google Sheets, using the API Connector add-on for Sheets.
We'll set up a custom OAuth connection (preset OAuth connection is coming soon) and connect to their API. Note: you must have a Salesforce plan that enables API access.
- Before You Begin
- Part 1: Get Your Salesforce OAuth Credentials
- Part 2: Connect the Salesforce API to API Connector
- Part 3: Get Salesforce Data in Sheets
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get your Salesforce OAuth Credentials
- Log in to Salesforce and click Settings > Setup
- Now scroll down the left sidebar and click Apps > App Manager
- On this page click New Connected App
- This will open up an app configuration form. Under Basic Information, fill in the app name and a contact email address.
- Under API (Enable OAuth Settings), tick the box to Enable OAuth settings, enter a callback URL, and select the scopes you'd like to have access to. Make sure to include "Perform requests at any time" to avoid expiring tokens immediately.
- Scroll to the bottom and hit Save.
- One more step: click Apps > App Manager > Manage > Edit Policies and change the IP Relaxation setting to Relax IP restrictions.
- Under Refresh Token Policy, change the refresh token policy to something other than "Immediately expire refresh token".
- Click Save again.
Part 2: Connect Salesforce to API Connector
- Open up Google Sheets and click Extensions > API Connector > Manage Connections
- Scroll to the bottom of the sidebar and click Add Custom OAuth
- Fill in the Custom OAuth modal as follows:
- Authorization Base URL:
- Token URL:
- Client ID: provided by Salesforce at App Manager > click app name > Manage Consumer Details
- Client Secret: provided by Salesforce at App Manager > click app name > Manage Consumer Details
- Click Save
- Click Manage Connections to return to the list of connections
- Scroll down until you find your new custom connection. Click Connect
- You'll be prompted to give access to the new app you created above. Click Allow
- You'll be returned to your sheet and can verify that the new connection is now active.
Part 3: Get Salesforce Data in Sheets
To create a request, include your full request URL in the request URL field, and select your custom Salesforce connection from the dropdown OAuth menu.
You can see the full list of available endpoint and parameters in the API documentation. For example, to get a list of leads, run a request like this:
- Request URL:
https://your_domain.my.salesforce.com/services/data/v57.0/query/?q=SELECT Id,FirstName,LastName FROM Lead
- To get standard fields or all fields, edit the query so it reads
/query/?q=SELECT FIELDS(STANDARD) FROM Lead LIMIT 200or
/query/?q=SELECT FIELDS(ALL) FROM Lead LIMIT 200or
- Where it says
Lead, substitute in any of the tables listed here, e.g.
Task, and so on.
Part 4: API Documentation
Official API documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_list.htm
SOQL Query documentation: https://developer.salesforce.com/docs/atlas.en-us.242.0.api_rest.meta/api_rest/dome_query.htm