Skip to main content
Enterprise Component — The SpreadsheetViewer component is available to Reducto enterprise customers. Contact sales@reducto.ai to get access.

Overview

The SpreadsheetViewer component provides a powerful, read-only Excel spreadsheet viewer with support for bounding box overlays. It’s designed to visualize Reducto extraction results directly on your spreadsheet documents.

Excel Support

View .xlsx and .xls files with full sheet navigation

Bounding Boxes

Overlay extraction results with clickable, colored regions

Zero Tailwind

CSS Variables for easy theming without Tailwind dependency

TypeScript

Full type definitions included for excellent DX

Installation

1

Configure npm registry

Create or update your project’s .npmrc file to authenticate with GitHub Packages:
.npmrc
Never commit your token directly to .npmrc. Use an environment variable as shown above.
2

Set your authentication token

Reducto will provide you with an access token. Set it as an environment variable:
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
Then reload your shell:
3

Install the package

4

Import the styles

Import the CSS file in your application’s entry point:
App.tsx or main.tsx

Quick Start

Here’s a minimal example to get you started:
The SpreadsheetViewer requires a container with defined dimensions. Always wrap it in a parent element with explicit height and width.

Usage Examples

Basic Viewer

Display a spreadsheet without any overlays:

With Bounding Boxes

Highlight specific regions of the spreadsheet with colored bounding boxes:

Integrating with Reducto API Results

Convert Reducto extraction results to bounding boxes:

Custom Styling with CSS Variables

Override the default styles using CSS variables:
custom-theme.css

API Reference

SpreadsheetViewer Props

string
required
URL to the Excel file (.xlsx or .xls). Can be a relative path, absolute URL, or blob URL.
BoundingBox[]
Array of bounding boxes to overlay on the spreadsheet.
(metadata: WorkbookMetadata) => void
Callback fired when the workbook is successfully loaded.
(error: SpreadsheetError) => void
Callback fired when an error occurs loading or parsing the file.
(bbox: BoundingBox) => void
Callback fired when a bounding box is clicked.
string
Additional CSS class name for the container element.
React.CSSProperties
Inline styles for the container element.

BoundingBox Type

WorkbookMetadata Type

SpreadsheetError Type

Troubleshooting

Ensure your .npmrc is configured correctly and the REDUCTO_NPM_TOKEN environment variable is set:
If using a monorepo, place the .npmrc in the root directory.
If loading files from a different domain, ensure the server sends appropriate CORS headers:
Alternatively, proxy the request through your own backend or use blob URLs.
Verify that:
  1. The page property matches the sheet number (1-indexed)
  2. The top and left values are within the sheet bounds
  3. You’ve imported the CSS file
Make sure you import the CSS file in your app’s entry point:
If using CSS modules or scoped styles, ensure the import is global.

Support

Get Access

Contact sales@reducto.ai to get access to @reductoai-collab/components and receive your authentication token.
For technical support, reach out to your Reducto account representative or email support@reducto.ai.