How Excel Workbook Viewer is built
Excel Workbook Viewer opens an .xlsx, .xlsm, or .xls file, lets you switch between its sheets, and shows the cells — read-only, nothing saved. This post is about the one validation step that runs before any of that, and the one thing this tool deliberately can’t show.
Tech used
SheetJS as a read-only parser
As in XLSX to CSV, parsing is done with SheetJS Community Edition, installed from the project’s own CDN distribution rather than its outdated npm listing, and loaded via a dynamic import('xlsx') so the ~500 KB parser never reaches the initial page bundle. XLSX.utils.sheet_to_json(worksheet, { header: 1 }) turns the active sheet into a 2D array of display values — formula cells resolve to their last-calculated result, matching Excel’s own default view of a formula cell rather than showing the formula text.
Large sheets are rendered through the same windowed table approach used by CSV Viewer: only the rows actually scrolled into view are mounted as DOM nodes, so opening a sheet with tens of thousands of rows doesn’t mean creating tens of thousands of <tr> elements up front.
Implementation & operational notes
A binary signature check runs before the file is treated as a workbook at all. .xlsx/.xlsm are ZIP archives (PK signature); a genuine .xls is either wrapped in a Compound File Binary container or, in older cases, a bare BIFF stream — three different, checkable byte patterns, none of which resemble each other. hasWorkbookSignature() inspects the file’s first few bytes against whichever pattern is expected before calling XLSX.read(), so a file that isn’t actually a spreadsheet — a renamed image, a corrupted download — produces one clear, specific error message immediately, instead of an opaque parser failure that gives no indication of what actually went wrong.
The viewer cannot show a workbook’s embedded pictures, and that’s a hard limit of the library, not an unfinished feature. SheetJS Community Edition — the free tier used across this fleet’s Excel tools — does not read or write image data at all; that capability is reserved for SheetJS’s paid Pro tier. So a workbook with pictures pasted into cells shows its text and numbers correctly, but the pictures themselves are invisible to this tool. Extract Images from Excel covers the same gap from the other direction: since it works directly against the ZIP container instead of going through SheetJS, it can pull those images out even though this viewer can’t display them in place.
Read-only means no code path writes to the workbook, not just no visible edit button. The engine only ever calls sheet_to_json for display; there is no serialization step anywhere in the tool, so there’s no risk of an edit UI accidentally producing a corrupted file — a class of bug this design doesn’t need to guard against, because the capability doesn’t exist.
A single unreadable workbook doesn’t take down the whole page. Whether the cause is a wrong file type, a corrupted download, or a genuinely unsupported container, a failed parse surfaces as a normal, localized error state — not a blank page or a thrown exception the user has to reload past.