@christophervr/xlsx-react-viewer
A browser Excel spreadsheet editor for React, using one shared editor and the canonical OOXML document engine.
Live demo | npm | Full docs | Source
Part of ooxml: Office · Word · Excel · PowerPoint · Visio · OpenTeams · Core
Install
npm install @christophervr/xlsx-react-viewer
Use the framework peers declared by this package: react (>=18). Existing framework apps normally already provide them.
The package bundles its editor UI and adapter. The core model and shared controls are installed as regular registry dependencies and the model API is re-exported. One viewer package is enough; no separate core install is required.
Quick start
import { useState } from 'react';
import { createWorkbook, SpreadsheetEditor } from '@christophervr/xlsx-react-viewer';
export function Editor() {
const [workbook, setWorkbook] = useState(() => createWorkbook());
return <SpreadsheetEditor workbook={workbook} onWorkbookChange={setWorkbook} />;
}
Mount in the browser and give the host a height. Use one editor package per application: each registers the same editor custom element.
Features
| Feature | Description |
|---|---|
| Editing | Shared grid, ribbon, formula bar, sheet tabs and workbook change events. |
| Files | XLSX, XLSM, XLTX, legacy XLS and CSV loading through core. |
| Model | createWorkbook, loadWorkbook, saveXlsx and core types from the package entry. |
| Frameworks | The same <xlsx-editor> UI behind six thin adapters. |
API
Shared option types, loadWorkbook and detectWorkbookFormat helpers are exported
from the package. Framework handles expose load, save and download. The
vanilla package supplies mountEditor(container, options) for framework-free
lifecycle management. ooxml-core and ooxml-ui are regular
dependencies. Parsing, formulas, editing and grid calculations live in core.
Building blocks
To build your own UI around the grid, use useViewerBuildingBlocks with SpreadsheetCanvas and
the optional Toolbar, FormulaBar and SheetTabs. The hook returns canvasProps,
toolbarProps (state, enabled flags and callbacks for formatting, undo, redo, formula entry and
sheet navigation), loading, error, mode, dirty, selection, collaboration and
editError, and takes host callbacks such as onOpenShareDialog and onValidationError. The
surface is read-only until you pass canEdit: true. No
title bar, ribbon, backstage or dialog is mounted. See the
building blocks guide.
Limitations
This is an early editor, without Microsoft Excel parity or guaranteed lossless saving for unsupported features. Legacy XLS input saves as XLSX. Pivot tables, slicers and sparklines are not editable; macros never execute. Review core diagnostics and the feature guide before relying on preservation.
Documentation
Privacy and network use
The Excel packages make no network request when opening, rendering, editing or saving a document: linked pictures are not fetched, linked data is not refreshed, and fonts come from the device only (nothing is downloaded from Google Fonts or any other font service). Hyperlinks open only when the reader follows them. Nothing collects analytics or telemetry. See PRIVACY.md.
License
Apache-2.0.
OneDrive integration
Use the optional shared ooxml-core/embedding/onedrive connection with host-supplied Microsoft
sign-in. See the Office package and integration reference
for this product's load/save API, native storage wiring, sharing permissions and conflict recovery.
The testing guide
separates test-local transports from live Microsoft acceptance. No simulation service is shipped;
OneDrive storage does not provide Microsoft Office coauthoring or automatic document merging.