A table looks correct on screen, but a workbook needs more than the same text in rectangular cells. Give ExcelJS the intended string and number values, then serialize an actual XLSX workbook. Renaming an HTML file does not perform that conversion.
Consider a fictional packing sheet with item code 0017 and quantity six. The code is a string whose leading zeros matter. The quantity is a number that can participate in calculations. Keep that distinction in the source objects before adding any cell formatting.

Open the complete example · Download the full HTML source
Create a workbook from the supplied records
The ExcelJS README documents its browser distributions, workbook interface, and cell value types. Load a chosen browser build before using its global object. Then construct a document workbook:
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('Packing');
sheet.addRow(['Item code', 'Quantity']);
sheet.addRow(['0017', 6]);
sheet.addRow(['0023', 4]);
For this supplied extract, there are two item rows and ten units. The header is not a third stock record. Keep those counts in a readable HTML summary beside the eventual download action.
Use a string for an identifier because it is an identifier, not because every value should become text. Formatting a numeric cell to display zeros is a different data decision from storing a text code. Decide which value a downstream reader should receive.
Serialize before announcing success
The document API provides workbook.xlsx.writeBuffer():
const bytes = await workbook.xlsx.writeBuffer();
const blob = new Blob([bytes], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
});
This creates workbook bytes and a browser Blob; it does not itself prove a recipient has saved a file. Connect the Blob to a real download action in the completed page. Keep its filename and reporting revision visible. If serialization fails, show that failure rather than leaving an earlier “Workbook ready” message beside changed source data.
In this site's embedded preview, Build workbook bytes checks serialization without requesting a file download. Use the direct XLSX link on this guide for the prepared workbook, or download the complete HTML and open it locally to run its download action.
Keep formulas separate from computed results
ExcelJS's formula documentation says the library does not calculate formula results. If you supply a formula and a cached result, the cached value must come from your own agreed calculation. Do not put an uncalculated formula into a workbook and claim the browser verified its answer.
For this two-row exercise, a numeric ten-unit summary is enough. If the reader needs a formula-bearing workbook instead, retain the formula, its expected result, and the conditions under which the receiving spreadsheet application recalculates it.
The existing HTML to Excel guide covers table transfer and a SheetJS route. This task builds a typed workbook with ExcelJS rather than asking Excel to interpret page markup.
Use an HTML reading copy in NOS to review the item codes and quantities. Keep the XLSX as the actual workbook deliverable when the recipient needs spreadsheet cells, and ask the reviewer to compare 0017 with the source before accepting the export.