XLS · BIFF8
Legacy Excel
API guide
The Excel API reads a rectangular preview from the first worksheet and edits selected cell records. It works with BIFF8 `.xls` streams and OLE-wrapped workbooks.
IMPLEMENTATION NOTES
What works
readOleXlsGrid returns a bounded grid (50 rows by 26 columns by default). Numeric edits update existing NUMBER or RK cells; string edits maintain the shared string table and can rebuild a single worksheet when the structure is recognized.
- Custom row and column bounds can be passed to the grid reader.
- String edits can replace supported cells or add a cell when the single-sheet layout is safe to resize.
- Unsupported edits return the exact original input bytes.
IMPLEMENTATION NOTES
Known limits
This is a data preview and cell writer, not an Excel calculation engine or workbook renderer.
- Only the first worksheet is exposed by the grid API.
- Formula values are not evaluated; shared strings split across CONTINUE records may not all resolve.
- Resizing is limited to single-worksheet workbooks. Multi-sheet files permit only safe in-place edits.
- Numeric writes target existing NUMBER or RK cells; string writes are bounded by understood SST and worksheet structures.
QUICK EXAMPLE
Use the supported API
Import the package root unless a subpath is shown in the sample.
import {
readOleXlsGrid,
writeOleXlsNumericCellEdit,
writeOleXlsStringCellEdit,
} from '@christophervr/ole2';
const grid = readOleXlsGrid(xlsBytes);
const numeric = writeOleXlsNumericCellEdit(xlsBytes, { row: 0, col: 0, value: 42 });
const text = writeOleXlsStringCellEdit(numeric, { row: 0, col: 1, value: 'Ready' });
if (text === xlsBytes) console.log('No supported edit was applied.');This guide documents the current package API. Unsupported or unsafe operations are described explicitly; format detection alone does not imply content support.
Back to format overview