
When JS Libraries Fail at 1M Rows: Generating XLSX via DuckDB SQL
Introduction I've been building LeapRows — a browser-based CSV analysis tool that runs entirely client-side using DuckDB-WASM, with no server involved. At some point I needed to add XLSX export. But every existing approach I tried fell apart at any meaningful scale. I eventually landed on a solution: generate Excel-compatible XML directly via DuckDB SQL, then compress it into an XLSX file using JSZip. This post covers why I went that route and how it works. Note: My day job is SEO, not software engineering — so please forgive any imprecise terminology. 🙏 The Problem: Exporting 1 Million Rows to XLSX in the Browser DuckDB-WASM's Built-in XLSX Export Was Unreliable My first attempt was DuckDB-WASM's native XLSX output (the COPY TO command via the Excel extension). It was unstable — Excel would throw "The file format or file extension is not valid" on some outputs and refuse to open the file. I ruled it out for production use and started looking for alternatives. JS Libraries Ran Out of M
Continue reading on Dev.to
Opens in a new tab




