Appearance
Function: parseWorkbook()
ts
function parseWorkbook(workbook: Workbook, headerRow?: number): Promise<Record<string, {
headers: string[];
data: Cell[][];
}>>;Defined in: src/excel/excel.tsx:223
Parse a workbook and extract headers and data from each sheet.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
workbook | Workbook | undefined | The ExcelJS workbook to parse. |
headerRow | number | 1 | The row number used as the header. Defaults to 1. |
Returns
Promise<Record<string, { headers: string[]; data: Cell[][]; }>>
An object keyed by sheet name. Each value has headers (string array) and data (2D Cell array).
Example
ts
const workbook = await mwFileToWorkbook(file);
const parsed = await parseWorkbook(workbook, 2);
console.log(parsed['Orders'].headers);