DEV Community

Loc Nguyen
Loc Nguyen

Posted on

High-performance, Bun-optimized Excel and CSV library for TypeScript. Work with Bun S3

Github: https://github.com/vanloctech/bun-spreadsheet
NPM: https://www.npmjs.com/package/bun-spreadsheet

Why This Package

  • Built for Bun, not adapted from Node-first abstractions — The core file paths use Bun.file(), Bun.write(), FileSink, and Bun-native streaming APIs directly.
  • Works naturally with Bun-native file targets, including S3 — Read from and write to local paths, Bun.file(...), and Bun S3File objects, including direct streaming exports to S3 destinations.
  • Production export helpers for Bun backends — Supports progress callbacks, AbortSignal, export diagnostics, streaming Response helpers, and S3 multipart tuning through Bun-native writer options.
  • TypeScript-first spreadsheet modelWorkbook, Worksheet, Row, Cell, and style objects are explicit and practical to work with in Bun apps.
  • Focused on real report workflows — Styles, formulas, hyperlinks, data validation, conditional formatting, auto filters, freeze/split panes, and workbook metadata are supported where they matter for business exports.
  • Multiple write strategies for different workloads — Use normal writes for simplicity, stream writes for lower memory pressure, and chunked disk-backed writes for large exports.

Benchmarks

Measured on Bun 1.3.10 / MacOS ARM with a single worksheet, compressed .xlsx, and 1,000,000 rows x 10 columns:

Mode Total time Finalize time Rows/sec Peak RSS Peak heapUsed File size
createExcelStream() 13.1s 8.9s 76,363 110.6MB 5.1MB 54.33MB
createChunkedExcelStream() 11.9s 8.5s 84,029 120.9MB 5.1MB 54.33MB

createExcelStream() now uses the same disk-backed low-memory path as the chunked writer for single-sheet exports, so the numbers are expected to be close. Re-run the large benchmark on your machine with:

Top comments (0)