More on the topic…
xlDuckDb is an Excel add-in that lets you run DuckDB SQL queries directly within spreadsheets, with results appearing as regular cells. You download the .xll file, unblock it in Windows, and double-click to register the DuckDbQuery function. It requires 64-bit Excel 365 (post-September 2018) and .Net 8.0 runtime. The core feature is querying Excel ranges, named ranges, and tables using standard SQL syntax — you just pass the range as an argument to DuckDbQuery, and it treats the data like a database table. You can also query multiple ranges in a single query by passing them as additional arguments and referencing them as xlRange[1], xlRange[2], etc.
Beyond Excel data, the add-in taps into DuckDB's ability to query external files directly. JSON files work particularly well — DuckDB handles nested structures through JSONPath syntax (using the `->>'$[0].category'` notation, for example) and can extract data from complex documents like the Nobel Prize laureate dataset. CSV files are handled with automatic delimiter and type detection. Parquet files, designed for efficient columnar storage, can be queried even when they're too large to fit in memory. You can also query data stored remotely on HTTPS or AWS S3, making it possible to pull holdings data from duckdb.org or attach to databases in cloud storage.
The real power emerges when combining sources. You can write a single SQL query that joins JSON data with CSV results, uses CTEs to transform one dataset, and then pivots the output for analysis. The article walks through practical examples — finding countries with the most Nobel laureates and cross-referencing their sales data, or analyzing Titanic passenger survival rates by cabin class and age. This transforms Excel from a static spreadsheet tool into something that can handle serious data work without leaving the familiar interface.
Questions about this article
No questions yet.