● CASE STUDY · OPEN SOURCE · AUTHOR & MAINTAINER

react-data-export

Styled Excel exports from React — because the open-source options either couldn't style cells or were too heavy to ship.

first published
Oct 2017
latest
v1.0.0 · 18 releases
downloads (at build)
41.8k/month
github (at build)
★ 175 · 200 forks
license
MIT
A spreadsheet exported with react-data-export: dark blue bold headers, a merged 'Revenue 2026' header over Q1 and Q2 columns, eight sales rows with dates such as 1 Mar 2021, euro amounts and percentages, banded rows, and a Total row summing Q1 to 356,347.90 € and Q2 to 371,537.30 €.
Sample data, exported with react-data-export 1.0.0 (exportDataset) and opened in LibreOffice Calc 26.8.

## the problem

React apps needed to hand users real spreadsheets, not CSVs — with fonts, fills, borders and number formats. Available libraries either didn't support writing cell styles or were too heavy to include in a frontend bundle.

## what I built

A declarative React API: describe the workbook as components, pass data or a styled multi-dataset, and render a download button.

import ReactExport from 'react-data-export';

const ExcelFile = ReactExport.ExcelFile;
const ExcelSheet = ReactExport.ExcelFile.ExcelSheet;
const ExcelColumn = ReactExport.ExcelFile.ExcelColumn;

<ExcelFile element={<button>Download</button>}>
  <ExcelSheet data={rows} name="Employees">
    <ExcelColumn label="Name" value="name" />
  </ExcelSheet>
</ExcelFile>

The 0.6 API, following examples/simple_excel_export_01.md at the repository's v0.6.0 tag. 1.0 runs it unchanged through the deprecated react-data-export/legacy entry.

## architecture

Legend: solid green = my code · dashed violet = my fork of third-party code · grey = third-party.

This is 0.6. 1.0, npm latest since November 2026, replaces tempa-xlsx and file-saver with javascript-excel 2.0.

## bundle size

What each usage adds to a Vite production build with React 19, on top of React alone (gzip -9):

  • 1.0 · exportDataset behind a button +24.7 KiB
  • 1.0 · every export of the main entry +31.5 KiB
  • 0.6.0 · <ExcelFile> + <ExcelSheet> + <ExcelColumn> +266.3 KiB

Source: the bundle-size fixture in react-data-export's bundler matrix, react-data-export #214 (Vite 8, React 19). Measured on 1.0.0-alpha.3; CI's install with javascript-excel 2.0.0-beta.0 gave the same numbers.

## decisions

  1. 01Fork instead of wait. Upstream couldn't write cell styles, so I published tempa-xlsx — a fork of SheetJS/js-xlsx that reads and writes cell formats.
  2. 02Components, not config. Workbooks are described the way React developers already think.
  3. 03Own the engine. 1.0 is built on javascript-excel 2.0 instead of the SheetJS fork, with a deprecated /legacy entry for 0.6 code.

## lessons

  1. 01Shipping is the easy half. Thirteen releases between 2017 and 2020 got styled spreadsheets into React apps. The library kept being installed long after the last release, and a dependency people rely on doesn't get to stand still.
  2. 02Forks are feedback. It has been forked more often than it has been starred: people patched it for their own needs rather than wait for me. Each fork marks something the core should have made configurable.
  3. 03A fork you depend on is a fork you maintain. tempa-xlsx unblocked cell styles quickly, then tied the library to an upstream that kept moving on without it.
  4. 04Say the plan where users look. Through the rewrite, the README said which version you get: a plain install stayed on 0.6.0 while the 1.0 rewrite on javascript-excel was a beta on next. 1.0.0 then moved latest, with a migration guide and a /legacy entry for 0.6 code.