Spreadsheet renderer for microscope-js, backed by SheetJS. Renders
.xlsx,.xls,.xlsm,.xlsb,.csv,.tsv, and.ods. Multi-sheet workbooks get a tab strip; HTML output is sanitized via the shared DOMPurify profile; formulas are never evaluated.
pnpm add @microscope-js/renderer-xlsx
import { createRegistry, mount } from '@microscope-js/core';
import { xlsxRenderer } from '@microscope-js/renderer-xlsx';
const registry = createRegistry([xlsxRenderer]);
const handle = await mount({ source: file, container, registry });
// renderer-specific capabilities
const cap = handle.capabilities as { sheetNames: string[]; showSheet(name: string): void };
console.log(cap.sheetNames);
cap.showSheet('Q4 Revenue');
| Option | Default | Description |
|---|---|---|
maxBytes |
64 * 1024 * 1024 |
Reject workbooks larger than this (MicroscopeError('TOO_LARGE')) |
initialSheet |
0 |
Index of the sheet shown on first render |
RenderHandleinterface XlsxHandle extends RenderHandle {
readonly capabilities: {
sheetNames: string[];
showSheet(name: string): void;
};
}
Wire a custom dropdown to showSheet() for a polished UX.
.xlsx / .xlsm / .xlsb (Office Open XML).xls (legacy binary).ods (OpenDocument).csv / .tsv (delimited text)cellFormula: false — formulas are dropped, not evaluated. No untrusted spreadsheet expression ever runs.sanitizeHtml from @microscope-js/utils before insertion.@microscope-js/renderer-docx · @microscope-js/renderer-pptx@microscope-js/react — React adapter