Run SOQL queries in Google Sheets

Run a raw SOQL query

Open Extensions → Data Integrator for Salesforce → Get Data using SOQL and type any SOQL SELECT statement, for example:

SELECT Id, Name, Account.Name FROM Contact WHERE CreatedDate = LAST_N_DAYS:30

SOQL gives you full control where the visual query builder stops: parent relationship fields (Account.Owner.Name), child sub-queries, date literals such as LAST_N_DAYS:30 or THIS_FISCAL_QUARTER, aggregates and GROUP BY. If the active cell already contains a query (for example one produced by Convert Report to SOQL), the dialog picks it up automatically.

Choose the destination

The result table can be written to:

  • A new sheet — named after the queried object, e.g. SOQL Account;
  • The current sheet — starting at the active cell, so you can place several query results side by side.

An optional header row contains the selected field names. Nested results (sub-query records) are rendered as JSON in their cell.

Save a SOQL query as a template

Check Save as a template in the dialog (optionally give it a name) and the query is stored together with its destination. Saved SOQL queries appear in the Execute/Update/Delete Templates for Current Sheet and Execute/Update/Delete All Templates sidebars under SOQL Queries, where you can:

  • Execute now — re-run the query; the previous output range is cleared and rewritten in place, so the table never leaves stale rows behind;
  • Open — edit the SOQL text, the header-row option or the template name, then Execute and Update Template;
  • Delete — remove the template (the sheet data stays).

Like regular pull templates, saved SOQL queries are refreshed by scheduled auto refresh, workflows and inbound webhooks.

Example queries

  • Open opportunities with owner and account:
    SELECT Name, Amount, StageName, Owner.Name, Account.Name FROM Opportunity WHERE IsClosed = false ORDER BY Amount DESC
  • Cases created this week, grouped by priority:
    SELECT Priority, COUNT(Id) FROM Case WHERE CreatedDate = THIS_WEEK GROUP BY Priority
  • Contacts with their most recent activity date:
    SELECT Name, Email, Account.Name FROM Contact WHERE LastActivityDate >= LAST_N_DAYS:90

Notes and limitations

  • Only SELECT statements are supported — use Upload to create or change records.
  • Very large results are truncated; the completion message tells you when this happens — narrow the query with a WHERE clause.
  • Field names must be API names (Custom_Field__c), exactly as in SOQL run from the Salesforce Developer Console.