cycyexcel
中文0.2.0

API

matrixToWorkbookSnapshot()

Convert a two-dimensional array to a WorkbookSnapshot. Imported sheet data is independent of the source array.

Signature

ts
function matrixToWorkbookSnapshot(
  matrix: readonly (readonly (CellValue | null | undefined)[])[],
  options?: MatrixToWorkbookSnapshotOptions
): WorkbookSnapshot
NameTypeDescription
matrixreadonly (readonly CellValue[])?[]Row i, column j maps to cell (i, j).
options.blankRowsnumberAdditional blank rows after the imported data.
options.blankColumnsnumberAdditional blank columns after the widest imported row.

Importing object arrays

Use rowsToWorkbookSnapshot(rows, fields) to import object arrays. fields specifies the import order; imported data uses the same snapshot format.

ts
function rowsToWorkbookSnapshot(
  rows: readonly ImportRow[],
  fields: readonly string[],
  options?: RowsToWorkbookSnapshotOptions
): WorkbookSnapshot