Run SOQL Queries Directly in Google Sheets: A Practical Guide

Visual query builders are fine until you need a parent field, an aggregate, or a date-relative filter. If you know SOQL, the fastest path from Salesforce to a spreadsheet is typing the query yourself. Data Integrator for Salesforce lets you run raw SOQL SELECT statements directly in Google Sheets.

Your first query

Open Data Integrator for Salesforce → Get Data using SOQL and type:

SELECT Id, Name, Account.Name, Owner.Name
FROM Contact
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC

Execute, and the result is written to a new sheet or to the current sheet starting at the active cell, with an optional header row.

What SOQL gives you that the builder cannot

  • Relationship fields — pull Account.Owner.Name on a Contact without a second query or VLOOKUP
  • Date literals — THIS_QUARTER, LAST_N_DAYS:90, NEXT_WEEK keep queries evergreen
  • Aggregates and GROUP BY — SELECT StageName, SUM(Amount) FROM Opportunity GROUP BY StageName builds a pipeline summary in one shot

Save queries as templates

Check “Save as a template” in the SOQL dialog and the query appears in your template sidebars, where you can re-execute it, edit the SOQL text, or delete it. The previous output is cleared and rewritten in place, so your downstream formulas keep working.

Refresh on a schedule

Saved SOQL queries participate in workflows and webhooks just like regular pull templates — schedule the refresh and your SOQL-powered dashboard updates itself.

More examples, including gotchas around relationship depth and query limits, are in the SOQL help article. Prefer clicking to typing? Start with the visual data import instead.

Leave a Reply

Your email address will not be published. Required fields are marked *