Sourcetable’s AI writes SQL queries from plain English. This works for data in your spreadsheet and for connected databases.Documentation Index
Fetch the complete documentation index at: https://sourcetable.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Using the SQL generator
Open the AI chat and select Query mode, or ask directly in the default mode. The AI generates the SQL, runs it, and returns results to your spreadsheet.Example prompts by complexity
| Complexity | Example prompt |
|---|---|
| Basic | ”Show me all orders from January” |
| Filtering | ”Find customers with more than 5 orders and total spend over $10,000” |
| Aggregation | ”What’s the average revenue by product category, broken down by quarter?” |
| Window functions | ”Rank each salesperson by their monthly revenue within their region” |
| Cohort analysis | ”Show monthly retention rates for each customer cohort by signup month” |
How it works
You describe what you want
Type a natural language description of the data you need: “Show me the top 10 customers by lifetime value who signed up this year.”
Query executes
The query runs against your data via DuckDB (for spreadsheet data) or directly on connected databases.
Iterative refinement
You can refine queries conversationally:- “Show me monthly revenue by region” — AI generates the initial query
- “Add a year-over-year growth column” — AI modifies the query
- “Filter to only regions with growth over 10%” — AI adds the condition
- “Make it a chart” — AI creates a visualization from the results
Error handling
If a query fails (syntax error, missing column, type mismatch), the AI:- Reads the error message
- Diagnoses the problem
- Rewrites and re-executes the corrected query
- Returns the results
Cross-source queries
When you have data in your spreadsheet and a connected database, you can query across both:- “Compare the revenue in my spreadsheet with the production database totals”
- “Join my local customer list with the orders table in PostgreSQL”
When to use AI SQL vs. the SQL editor
| Use AI SQL generator when… | Use the SQL editor when… |
|---|---|
| You want quick answers without writing SQL | You know the exact query you need |
| You’re exploring data and aren’t sure what to look for | You want to save queries to the data library |
| You need to iterate and refine results conversationally | You prefer the visual query builder |
| You’re working across multiple data sources | You need precise control over query syntax |
Data library
Save AI-generated queries for reuse. After the AI runs a query:- Click Save to Library on the result
- Name and categorize the query
- Access it later from the data library sidebar
- Schedule queries to refresh automatically with automated reporting