1.7k

React Excel Editor

A React Excel editor component for editing XLSX workbooks with formula input, cell styles, undo and redo, sheet controls, merge tools, export, and live grid updates.

The React Excel Editor is a spreadsheet editing surface built on top of @extend-ai/react-xlsx. It keeps the viewer shell familiar while enabling direct XLSX workbook mutations through the package editing API.

Installation

First configure the style-aware registry in components.json so the CLI uses the primitives for your project.

pnpm dlx shadcn@latest add @extend/xlsx-editor

Useful behaviors

  • Formula bar shows the selected cell's formula, or its display value when no formula is present.
  • Font family, font size, font effects, text color, fill color, borders, alignment, wrapping, shrink-to-fit, and number formats use persisted react-xlsx cell style APIs.
  • Undo, redo, merge, unmerge, sheet add/remove, and export are wired through react-xlsx editing APIs.
  • Use Freeze panes in the editor header to freeze at the selection, freeze the top row or first column, or unfreeze.
  • Click the line marking hidden rows or columns to reveal them, or right-click the line and choose Unhide.
  • Right-click a row number or column letter to hide or unhide that axis. To unhide a block, select the headers on either side and choose Unhide. For a hidden first row or column, select the first visible header.
  • Right-click cells or headers for clipboard, editing, selection, merge, and table-sort commands. Shift+F10 opens the same menu from the keyboard; failed commands keep their error visible.
  • Sheet tabs, workbook loading, upload, zoom, table sorting, and dark workbook rendering match the Excel Viewer.
  • Pivot fields support creation, field placement, filtering, grouping, calculated fields, chart insertion, refresh, and source details using the same themed controls as the toolbar.
  • Chart and image context menus include nested commands and checked selections. Form controls, chart loading states, and image resize handles follow the component theme.
  • Large workbooks automatically fall back to read-only behavior above the editor threshold.

API Reference

XlsxEditorPreview

The XlsxEditorPreview component renders an editable Excel workbook with upload, theme, zoom, formula editing, cell styling, sheet controls, and export.

PropTypeDefaultRequired
classNamestring-No
fileNamestring-No
isDarkboolean-Yes
onIsDarkChange(isDark: boolean) => void-Yes
srcstring-No