Salesforce Lookup (=salesforce_lookup)

Section header image mobile

The salesforce_lookup formula lets you pull one or more field values from a single Salesforce record by matching any field. Use this when you want to look up fields based on values like `Account Name`, `Email`, or `Opportunity Name`.

It works just like VLOOKUP, but for your Salesforce data — straight into your spreadsheet.

Demo

Syntax

Arguments

Field List Syntax (fields)

Best Practices & Tips

Common Errors

 

Demo

Syntax

=salesforce_lookup(object_type, lookup_field, lookup_value, fields_list)

Arguments

Argument Required Description
object_type YES The Salesforce object you want to search, e.g. "Account", "Contact", "Opportunity", "Lead"
lookup_field YES The field you want to match against, e.g. "Email" or "Account Name"
lookup_value YES The value to match, e.g. "john@example.com" or "Acme Corp"
fields YES A comma-separated list of fields to return or a cell range (like B1:D1)

Field List Syntax (fields_list)

You can:

  • List fields directly: "Name, Industry, Type"
  • Reference a cell range: A1:A3 or B1:D1
  • Field names are case-insensitive, but best practice is to match the Salesforce field label.
  • Include related fields: You can use fields from related objects, by using the format Field Name (Relation). Example: Email (Owner)

Examples:

Fetch the account industry and type using the account name.

=salesforce_lookup("Account", "Name", "Acme Corp", "Industry, Type")

Lookup a contact by email and return their name and phone.

=salesforce_lookup("Contact", "Email", A3:A25, "First Name, Last Name, Phone")

ℹ️ Note: If you intend to run a lookup across multiple records, it would be easier for you to reference them in a single formula like A3:A25 in this example, which points to individual emails to be looked up.

Lookup opportunity details from the name.

=salesforce_lookup("Opportunity", "Name", "Q4 Expansion Deal", "Amount, Stage, Close Date")

Use a header range for the field list.

=salesforce_lookup("Lead", "Email", A2, B1:D1)

Best Practices & Tips:

  • Instead of dragging-down a single lookup across multiple rows, consider merging it all into a single formula. That will help you save on API limits with Salesforce:
=salesforce_lookup("Contact", "Email", A3:A25, "First Name, Last Name, Phone")

Common Errors

Error Message Cause
Internal error executing the custom function This error happens in Google Sheets when a formula takes longer than 30 seconds to execute. Try executing the formula again.
Salesforce connection requires reauth Open the sidebar and reauthorize Salesforce for the formula to continue to work.
Invalid object type The object name doesn’t match any in your Salesforce schema.
Invalid field name One or more fields don't exist in the object you queried.
Filter syntax error The filter_string is formatted incorrectly.

 

Was this article helpful? 0 out of 0 found this helpful