RAWQL / LOCAL SQL WITH DUCKDB
Query Excel files with SQL
Turn a worksheet into a queryable view, check its column types and calculate a total without changing the original workbook.
RawQL is in invite-only beta. These guides and sample files are public. You need beta access to run the examples in the editor.
Start with a rectangular worksheet
Download orders.xlsx. The single worksheet contains a header row and six fictional orders. Import it from Databases → Data files. Its view is named orders_xlsx.
For your own workbook, use one header row, consistent column names and one record per row. Remove merged headers and presentation-only totals from the analysis sheet. RawQL accepts XLSX and legacy XLS; XLS conversion happens locally before DuckDB reads it.
Check the imported columns
DESCRIBE orders_xlsx;Inspect order_id, customer_id, status and amount. Cell formatting alone does not prove a column is numeric. A value that looks like a number in Excel may have been stored as text.
Calculate paid-order revenue
SELECT COUNT(*) AS paid_orders,
SUM(TRY_CAST(amount AS DECIMAL(12, 2))) AS revenue
FROM orders_xlsx
WHERE status = 'paid';| paid_orders | revenue |
|---|---|
| 4 | 460.00 |
Find values that cannot be converted
TRY_CAST returns NULL when conversion fails. SUM ignores NULL, which can hide a bad value. Run this check before trusting a total:
SELECT order_id, amount
FROM orders_xlsx
WHERE amount IS NOT NULL
AND TRY_CAST(amount AS DECIMAL(12, 2)) IS NULL;The sample returns no rows. If your file returns currency symbols, thousands separators or notes, review their meaning before removing characters. Do not silently replace failed conversions with zero.
Workbooks with several sheets or formulas
The default import reads the first sheet. Check that it is the intended dataset. For another sheet, prepare a workbook containing that sheet or export it as CSV. This guide does not rely on a sheet-selection interface.
RawQL is an SQL workspace, not an Excel calculation engine. Recalculate and save formula-heavy workbooks in your spreadsheet application before importing; check the imported values against the source.
Save and export
Save the SQL as a worksheet or notebook, then export the query result. Imported files are local to the browser session. Use a workspace snapshot to preserve the data needed by your queries. Current limits are three loaded files and 100 MB per file.
For SQL reader options, see DuckDB Excel documentation. For joins between two exports, continue with the CSV guide below.