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 → Add local sources → Add files, review the preview and confirm Import selected sheets. 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
Select one or more sheets in the Excel import dialog. Preview each sheet, choose its header row (or no header), optionally enter a populated cell range such as A2:D100, and check each SQL name before confirming. These options are applied locally before the WASM reader and preserved in workspace snapshots and local-source refreshes. Existing SQL objects are never implicitly replaced by a new import. Each selected sheet counts as one imported file.
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 10 loaded files and 100 MiB per file.
For SQL reader options, see DuckDB Excel documentation. For joins between two exports, continue with the CSV guide below.
Continue exploringBrowse the other guides
RawQL