Skip to main content
Sourcetable includes a built-in SQL editor that lets you query both spreadsheet data and connected databases using standard SQL syntax. It runs on DuckDB, which means fast, in-browser SQL execution.

Opening the SQL editor

Access the SQL editor from the sidebar or toolbar. You can also ask the AI: “Open the SQL editor.”

Querying spreadsheet data

Your sheet names act as table names, and column headers act as column names:

Cross-sheet queries

Query across multiple sheets in the same workbook:

Querying connected databases

When you have database connectors configured, select the data source from the dropdown at the top of the SQL editor, then write your query. Sourcetable runs the query on the remote database and returns results to your spreadsheet.

Supported SQL features

Visual query builder

The query builder lets you construct queries without writing SQL:
1

Select tables

Choose which sheets or connected tables to query from dropdown menus.
2

Pick columns

Select which columns to include in the output.
3

Add conditions

Build WHERE clauses with visual filter controls — select a column, operator (equals, contains, greater than, etc.), and value.
4

Configure joins

If querying multiple tables, define join conditions with visual dropdown selectors for left table, right table, and join columns.
5

Apply functions

Add aggregations, Excel-like functions (XL functions), and transformations.
6

Preview and run

See a live preview of your query results as you build. Click Run to execute.

Data library

Save frequently used queries for reuse:
  1. Write and test your query
  2. Click Save to Library
  3. Name and categorize the query
  4. Access it later from the data library in the sidebar
Saved queries can be shared with team members and reused across workbooks.

AI-powered queries

Instead of writing SQL manually, ask the AI in natural language:
  • “Show me the top 10 products by revenue this quarter”
  • “How many new customers signed up each month?”
  • “What’s the average order value by customer segment?”
The AI generates and runs the SQL query, then returns the results. See SQL generator for more details.