Workbook
Individual workbook within a model. Contains Sheets which contain Cells. Contains its own dependency graph, for now at least, so no dependencies between workbooks.
Extends
Section titled “Extends”emitter
Implements
Section titled “Implements”Properties
Section titled “Properties”charts
Section titled “charts”charts: ChartCSF[];cloud_connection
Section titled “cloud_connection”cloud_connection: CloudConnection | null;comments
Section titled “comments”readonly comments: CommentsManager;Workbook-level comment operations. See CommentsManager.
defect
Section titled “defect”defect: string | null;externals
Section titled “externals”externals: External[];id: string;isExternal
Section titled “isExternal”isExternal: boolean;Whether this workbook was loaded as an external reference from another workbook.
metadata
Section titled “metadata”metadata: GridMetadata;mode: WorkbookMode;Implementation of
Section titled “Implementation of”name: string;readonly notes: NotesManager;Workbook-level note operations. See NotesManager.
people
Section titled “people”people: Person[] = [];Authors of cell comments, or people mentioned in a cell comment.
ready: boolean = false;replacedBy
Section titled “replacedBy”replacedBy: string | null = null;reserved for outside use (client loader)
styles
Section titled “styles”readonly styles: StyleManager;tables
Section titled “tables”readonly tables: TableManager;Table collection operations. See TableManager.
readonly theme: ThemeManager;Get and set workbook theme properties.
type: | "unknown" | "airtable" | "notion" | "smartsheet" | "csv" | "excel" | "form-submissions" | "google-sheets" | "native";The origin of the workbook (Excel, Google Sheets, CSV, etc).
update_time
Section titled “update_time”update_time: string | undefined;version
Section titled “version”version: number | undefined;views?
Section titled “views?”optional views: WorkbookView[];Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get env(): Map<"isPrint" | "isMobile" | "username", MaybeBoxedFormulaArgument>;Returns
Section titled “Returns”Map<"isPrint" | "isMobile" | "username", MaybeBoxedFormulaArgument>
Implementation of
Section titled “Implementation of”errorLevel
Section titled “errorLevel”Get Signature
Section titled “Get Signature”get errorLevel(): number;Returns
Section titled “Returns”number
errors
Section titled “errors”Get Signature
Section titled “Get Signature”get errors(): ModelError[];Returns
Section titled “Returns”lazyImportPromise
Section titled “lazyImportPromise”Get Signature
Section titled “Get Signature”get lazyImportPromise(): Promise<void>;Returns
Section titled “Returns”Promise<void>
Methods
Section titled “Methods”_applyWrite()
Section titled “_applyWrite()”_applyWrite( refStr, value, oldSheetCount, oldSheetIndex): void;Write value value to the given reference, or to the same address in
the sheet with index oldSheetIndex if sheet count matches oldSheetCount
Parameters
Section titled “Parameters”refStr
Section titled “refStr”string
oldSheetCount
Section titled “oldSheetCount”number
oldSheetIndex
Section titled “oldSheetIndex”number | null
Returns
Section titled “Returns”void
_getExistingCachedFormulaCell()
Section titled “_getExistingCachedFormulaCell()”_getExistingCachedFormulaCell(formula, prefix): object;Parameters
Section titled “Parameters”formula
Section titled “formula”string
prefix
Section titled “prefix”string = CACHED_FORMULA_CELL_ID_PREFIX
Returns
Section titled “Returns”object
cell: DefinedName | null;id: string;_markCellsReferencingRemovedSheetForRecalculation()
Section titled “_markCellsReferencingRemovedSheetForRecalculation()”_markCellsReferencingRemovedSheetForRecalculation(sheetBeingRemoved): void;Parameters
Section titled “Parameters”sheetBeingRemoved
Section titled “sheetBeingRemoved”Returns
Section titled “Returns”void
_rewriteFormulasReferencingRenamedSheet()
Section titled “_rewriteFormulasReferencingRenamedSheet()”_rewriteFormulasReferencingRenamedSheet( sheet, currentName, newName): void;Precondition: formula parser has finished importing (formulaParserReady has resolved).
Parameters
Section titled “Parameters”currentName
Section titled “currentName”string
newName
Section titled “newName”string
Returns
Section titled “Returns”void
_writesIter()
Section titled “_writesIter()”_writesIter(): IterableIterator<[string, CellValue, KnownVertexId]>;Precondition: Workbook must be initialized
Returns
Section titled “Returns”IterableIterator<[string, CellValue, KnownVertexId]>
addSheet()
Section titled “addSheet()”addSheet(sheetName?, index?): WorkSheet;Add a new empty sheet to the workbook
Parameters
Section titled “Parameters”sheetName?
Section titled “sheetName?”if no sheet name is provided a unique sheet name will be generated
string | null
index?
Section titled “index?”number
if no index is provided the sheet will be appended to the list of sheets
Returns
Section titled “Returns”clearCachedFormulasExcept()
Section titled “clearCachedFormulasExcept()”clearCachedFormulasExcept(formulas): void;Parameters
Section titled “Parameters”formulas
Section titled “formulas”string[]
Returns
Section titled “Returns”void
clearCells()
Section titled “clearCells()”clearCells(ref): boolean;Precondition: Workbook must be initialized
Parameters
Section titled “Parameters”A reference to the cell, or range of cells, to clear. Defined names are not supported.
string | Reference
Returns
Section titled “Returns”boolean
true if any changes were made (so a recalculation is in order).
deleteColumns()
Section titled “deleteColumns()”deleteColumns( sheetName, columnIndex, count): RewriteFormula;Delete count columns at a specific index in the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
columnIndex
Section titled “columnIndex”number
0-based column index
number
how many columns should be deleted
Returns
Section titled “Returns”deleteRows()
Section titled “deleteRows()”deleteRows( sheetName, rowIndex, count): RewriteFormula;Delete count rows at a specific index in the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
rowIndex
Section titled “rowIndex”number
0-based row index
number
how many rows should be deleted
Returns
Section titled “Returns”emit()
Section titled “emit()”emit(event, ...arguments_): Emitter;Emit an event, invoking all handlers registered for it.
Parameters
Section titled “Parameters”string
The name of the event to emit.
arguments_
Section titled “arguments_”…any[]
Arguments to pass to the event handlers.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.emitgetCell()
Section titled “getCell()”getCell(cellId, sheetName?): Cell | null;Parameters
Section titled “Parameters”cellId
Section titled “cellId”string
sheetName?
Section titled “sheetName?”string | null
Returns
Section titled “Returns”Cell | null
getGlobal()
Section titled “getGlobal()”getGlobal(name): | FormulaError | DefinedName;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”getSheet()
Section titled “getSheet()”getSheet(sheetName?): WorkSheet | null;Parameters
Section titled “Parameters”sheetName?
Section titled “sheetName?”string | null
Returns
Section titled “Returns”WorkSheet | null
the named sheet if sheetName is truthy (null if not found), else the first sheet.
getSheetByIndex()
Section titled “getSheetByIndex()”getSheetByIndex(index?): WorkSheet | null;Get a sheet of the given index or else, if index is not provided, the first sheet of this workbook.
Parameters
Section titled “Parameters”index?
Section titled “index?”the index of a sheet
number | null
Returns
Section titled “Returns”WorkSheet | null
the sheet found at the given index, or else the first sheet if none was given. If no sheets are present this method returns null.
getSheetIndex()
Section titled “getSheetIndex()”getSheetIndex(sheetName?): number | null;Get the order index of a sheet with the given name.
Parameters
Section titled “Parameters”sheetName?
Section titled “sheetName?”string
the name of the sheet whose index should be returned. It will be matched case-insensitively.
Returns
Section titled “Returns”number | null
The index of the sheet with the given name, or null if no sheet with that name exists, or 0 if no/empty name was given.
getSheets()
Section titled “getSheets()”getSheets(): WorkSheet[];Returns
Section titled “Returns”getSheetSize()
Section titled “getSheetSize()”getSheetSize(sheetName?): [number, number];Get the size of a sheet with the given name.
Parameters
Section titled “Parameters”sheetName?
Section titled “sheetName?”the name of the sheet whose size should be returned. It will be matched case-insensitively. If not provided, or empty, the size of the first sheet (0, 0) is returned.
string | null
Returns
Section titled “Returns”[number, number]
The size of the sheet with the given name, or null if no sheet with that name exists, or (0, 0) if no/empty name was given.
getTable()
Section titled “getTable()”getTable(name): Table | null;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Table | null
getTables()
Section titled “getTables()”getTables(): Table[];Returns
Section titled “Returns”Table[]
getViews()
Section titled “getViews()”getViews(): WorkbookView[];Gets the workbook’s saved view configurations (active sheet, etc).
Copies are returned to prevent external mutation of the workbook’s views.
Returns
Section titled “Returns”WorkbookView[]
hasListeners()
Section titled “hasListeners()”Call Signature
Section titled “Call Signature”hasListeners(event): boolean;Check if there are any handlers registered for a specific event.
Parameters
Section titled “Parameters”string
The name of the event.
Returns
Section titled “Returns”boolean
true if there are one or more handlers, false otherwise.
Inherited from
Section titled “Inherited from”EventEmitter.hasListenersCall Signature
Section titled “Call Signature”hasListeners(): boolean;Check if there are any handlers registered for any event.
Returns
Section titled “Returns”boolean
true if there are one or more handlers for any event, false otherwise.
Inherited from
Section titled “Inherited from”EventEmitter.hasListenersinsertColumns()
Section titled “insertColumns()”insertColumns( sheetName, columnIndex, count, toTheRight): RewriteFormula;Insert count columns at a specific index in the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
columnIndex
Section titled “columnIndex”number
0-based column index
number
how many columns to insert
toTheRight
Section titled “toTheRight”boolean
determines whether the inserted columns are inserted to the
left or right of the column at columnIndex.
Returns
Section titled “Returns”insertRows()
Section titled “insertRows()”insertRows( sheetName, rowIndex, count, below): RewriteFormula;Insert count rows at a specific index in the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
rowIndex
Section titled “rowIndex”number
0-based row index
number
how many rows to insert
boolean
determines whether the inserted rows are inserted below or
above of the row at rowIndex.
Returns
Section titled “Returns”isGlobal()
Section titled “isGlobal()”isGlobal(name): boolean;Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
iterDataTableCells()
Section titled “iterDataTableCells()”iterDataTableCells(): IterableIterator<Cell>;Returns
Section titled “Returns”IterableIterator<Cell>
iterFormulaCells()
Section titled “iterFormulaCells()”iterFormulaCells(): IterableIterator< | Cell| DefinedName>;Returns
Section titled “Returns”IterableIterator<
| Cell
| DefinedName>
listenerCount()
Section titled “listenerCount()”Call Signature
Section titled “Call Signature”listenerCount(event): number;Get the count of listeners for a specific event.
Parameters
Section titled “Parameters”string
The name of the event.
Returns
Section titled “Returns”number
The number of listeners for the event.
Inherited from
Section titled “Inherited from”EventEmitter.listenerCountCall Signature
Section titled “Call Signature”listenerCount(): number;Get the count of all event handlers in total.
Returns
Section titled “Returns”number
The total number of event handlers.
Inherited from
Section titled “Inherited from”EventEmitter.listenerCountlisteners()
Section titled “listeners()”listeners(event): (...arguments_) => void[];Retrieve the event handlers registered for a specific event.
Parameters
Section titled “Parameters”string
The name of the event.
Returns
Section titled “Returns”(…arguments_) => void[]
An array of functions registered as handlers for the event.
Inherited from
Section titled “Inherited from”EventEmitter.listenersmergeCells()
Section titled “mergeCells()”mergeCells( sheetName, rangeStr, options): void;Merge a range of cells on the given sheet.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
name of the sheet
rangeStr
Section titled “rangeStr”string
range in A1 notation, e.g. “A1:B2”
options
Section titled “options”recalcNow?
Section titled “recalcNow?”boolean = true
if true (default), recalculate after merging; set to false to batch multiple merges before a single recalc
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if the sheet does not exist, the range is a single cell, or overlaps an existing merge
moveCells()
Section titled “moveCells()”moveCells( from, to, recalcNow): RewriteFormula;Precondition: formula parser has finished importing (formulaParserReady has resolved).
Parameters
Section titled “Parameters”Must be the same dimensions as to
string | A1Reference
Must be the same dimensions as from
string | A1Reference
recalcNow
Section titled “recalcNow”boolean = true
If false, skip the recalculate() call at the end. Useful when the caller will write more data before recalculating.
Returns
Section titled “Returns”moveColumns()
Section titled “moveColumns()”moveColumns( sheetName, from, to, count): RewriteFormula;Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
0-based index of first column to move
number
0-based index of end-position of first column to move
number
the number of columns to move
Returns
Section titled “Returns”moveRows()
Section titled “moveRows()”moveRows( sheetName, from, to, count): RewriteFormula;Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
number
0-based index of first row to move
number
0-based index of end-position of first row to move
number
the number of rows to move
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”off(event, listener): Emitter;Remove a specific event handler for a specified event.
Parameters
Section titled “Parameters”string
The name of the event.
listener
Section titled “listener”(…arguments_) => void
The specific handler function to remove.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.offCall Signature
Section titled “Call Signature”off(event): Emitter;Remove all event handlers for a specified event.
Parameters
Section titled “Parameters”string
The name of the event for which to remove all handlers.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.offCall Signature
Section titled “Call Signature”off(): Emitter;Remove all event handlers for all events.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.offon(event, listener): Emitter;Register an event handler that listens to a specified event.
Parameters
Section titled “Parameters”string
The name of the event to listen to.
listener
Section titled “listener”(…arguments_) => void
The function to execute when the event is emitted.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.ononce()
Section titled “once()”once(event, listener): Emitter;Register a one-time event handler for a specified event.
Parameters
Section titled “Parameters”string
The name of the event to listen to.
listener
Section titled “listener”(…arguments_) => void
The function to execute once when the event is emitted.
Returns
Section titled “Returns”Emitter
The Emitter instance for method chaining.
Inherited from
Section titled “Inherited from”EventEmitter.onceremoveDefinedName()
Section titled “removeDefinedName()”removeDefinedName(name, sheetName?): boolean;Remove a defined name (global or sheet-scoped) from the workbook. This will schedule cells depending on that name for recalculation, but will not perform that recalculation.
Parameters
Section titled “Parameters”string
the name of the defined name to remove. It will be matched case-insensitively.
sheetName?
Section titled “sheetName?”the name of a sheet the defined name is scoped to, null if it is a global defined name. It will be matched case-insensitively.
string | null
Returns
Section titled “Returns”boolean
true if the name was removed, false if it did not exist (or the sheet did not exist)
removeSheet()
Section titled “removeSheet()”removeSheet(sheetName): boolean;Remove a sheet from the workbook.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
the name of the sheet to delete. It will be matched case-insensitively.
Returns
Section titled “Returns”boolean
true if the sheet was removed, false if it did not exist
Throws
Section titled “Throws”if there are writes that have not been reset
renameSheet()
Section titled “renameSheet()”renameSheet(currentName, newName): void;Rename the given sheet to a new name, updating all formulas referencing it
Precondition: formula parser has finished importing (formulaParserReady has resolved).
Parameters
Section titled “Parameters”currentName
Section titled “currentName”string
newName
Section titled “newName”string
must be different from currentName
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if no sheet exists named currentName
requireSheet()
Section titled “requireSheet()”requireSheet(sheetName): WorkSheet;Like getSheet, but throws if the sheet does not exist.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
Returns
Section titled “Returns”reset()
Section titled “reset()”reset(): void;Returns
Section titled “Returns”void
rewriteFormulas()
Section titled “rewriteFormulas()”rewriteFormulas(rewriteFormula, recalcNow): number;Parameters
Section titled “Parameters”rewriteFormula
Section titled “rewriteFormula”(formula) => string
recalcNow
Section titled “recalcNow”boolean = true
If false, skip the trailing recalculate(). The caller is responsible for triggering recalculation after any additional mutations.
Returns
Section titled “Returns”number
number of formulas changed
rowHeight()
Section titled “rowHeight()”rowHeight(rowIndex, sheetName): number;Height of the given column in the given sheet, in pixels.
Parameters
Section titled “Parameters”rowIndex
Section titled “rowIndex”number
1-based row index
sheetName
Section titled “sheetName”string
name of the sheet in which to look up a row height
Returns
Section titled “Returns”number
setColumnWidth()
Section titled “setColumnWidth()”setColumnWidth( sheetName, column, width): void;Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
column
Section titled “column”number
0-based column index
number
non-negative
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if there is no sheet with sheetName in this workbook, or if col and/or width are invalid
setDefinedName()
Section titled “setDefinedName()”setDefinedName<AbortOnError>( name, formula, sheet?, abortOnError?, validateNow?): | DefinedName | AbortOnError extends true ? null : never;Add a defined name in this workbook with the given formula.
If any error is detected in the formula (syntax error, or use of something
we do not support), abort and return null if abortOnError is true, else
go ahead and make the defined name but record the error with this.addError.
This method does not create a vertex in the dependency graph. If the graph
is already built (i.e. outside initial workbook construction), the caller
must call updateDependencies([dn.vertexId]) on the returned DefinedName
to register its vertex and outgoing edges.
Type Parameters
Section titled “Type Parameters”AbortOnError
Section titled “AbortOnError”AbortOnError extends boolean = false
Parameters
Section titled “Parameters”string
formula
Section titled “formula”string
sheet?
Section titled “sheet?”sheet to scope the name to, or null for workbook scope
WorkSheet | null
abortOnError?
Section titled “abortOnError?”AbortOnError
true to return null and make no change if formula has any errors
validateNow?
Section titled “validateNow?”boolean = true
set to false to skip formula validation here (caller is responsible for it then)
Returns
Section titled “Returns”| DefinedName
| AbortOnError extends true ? null : never
setRowHeight()
Section titled “setRowHeight()”setRowHeight( sheetName, rowNum, height): void;Sets the height of a row.
One function, SUBTOTAL, may yield different results depending on whether some cells in the range belong to hidden rows or not. Therefore, if the row becomes hidden, or was hidden before this change, a recalculation of formulas referencing cells in the affected row will be required. This call will register state about that, so that the next recalculation will update formula cells as needed. It is up to the caller to make sure a recalculation is eventually triggered.
Precondition: Workbook is initialized.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
rowNum
Section titled “rowNum”number
0-based row index
height
Section titled “height”number
non-negative
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if there is no sheet with sheetName in this workbook, or if rowNum and/or height are invalid
toCSF()
Section titled “toCSF()”toCSF(): CSFOutput;Returns
Section titled “Returns”CSFOutput
toJsf()
Section titled “toJsf()”toJsf(): JSF;Serialize this workbook to JSF (JSON Spreadsheet Format).
This is the inverse of Workbook.fromJsf, producing a JSF object that can be used to reconstruct the workbook state.
Returns
Section titled “Returns”JSF
A JSF object representing this workbook
toXlsx()
Section titled “toXlsx()”toXlsx<T>(outputType): Promise<XlsxOutputMap[T]>;Convert this workbook to XLSX format and return the result as a Buffer.
This method converts the workbook to JSF format first, then generates an XLSX file from that representation.
Type Parameters
Section titled “Type Parameters”T extends keyof XlsxOutputMap = "nodebuffer"
Parameters
Section titled “Parameters”outputType
Section titled “outputType”T = ...
The output format: 'nodebuffer' (default) or 'arraybuffer'
Returns
Section titled “Returns”Promise<XlsxOutputMap[T]>
A Buffer containing the XLSX file data
toXlsxFile()
Section titled “toXlsxFile()”toXlsxFile(path): Promise<void>;Convert this workbook to XLSX format and write it to a file.
This method converts the workbook to JSF format first, then generates an XLSX file from that representation and writes it to the specified path.
Parameters
Section titled “Parameters”string
The file path to write the XLSX file to
Returns
Section titled “Returns”Promise<void>
unmergeCells()
Section titled “unmergeCells()”unmergeCells(sheetName, rangeStr): void;Unmerge cells on the given sheet. Any existing merge that overlaps the given range is fully removed. If no merges overlap, this is a no-op.
Parameters
Section titled “Parameters”sheetName
Section titled “sheetName”string
name of the sheet
rangeStr
Section titled “rangeStr”string
range in A1 notation, e.g. “A1:B2”
Returns
Section titled “Returns”void
Throws
Section titled “Throws”if the sheet does not exist
write()
Section titled “write()”write( ref, val, neutralizeFormulaOnSingleCellWrite?): boolean;Write the given value to the given cell (A1 address or global name)
Precondition: Workbook must be initialized
Parameters
Section titled “Parameters”the address or global name to write to
string | Reference
the value to write
neutralizeFormulaOnSingleCellWrite?
Section titled “neutralizeFormulaOnSingleCellWrite?”boolean = false
set to true if writes to single formula cells should neutralize them
Returns
Section titled “Returns”boolean
true if a write occurred
writeCellData()
Section titled “writeCellData()”writeCellData(cellRef, cellData): | Cell | DefinedName;Write the given cell data attributes (.v, .f, etc.) to an existing or
new cell.
If cell value is an error value, normalize it to the corresponding
singleton error value in errorTable.
If cellData has a formula, it is parsed and (if parsing succeeds) the AST
is stored in the cell object.
If cellData has an .f attribute (whether null or not), the whole
workbook’s dependency graph is rebuilt (unless you pass false for
rebuildDependencyGraph).
Preconditions:
- Formula parser has finished importing (
formulaParserReadyhas resolved). - Workbook must be initialized.
Parameters
Section titled “Parameters”cellRef
Section titled “cellRef”the cell to write, as a Reference or
a string representing one. If this indicates a range, the top-left cell
of that range is written. This must not be a name reference as this
method does not support those yet.
string | Reference
cellData
Section titled “cellData”Omit<Cell, "s" | "f" | "v"> & object & object & object
object with attributes to write to the cell
Returns
Section titled “Returns”| Cell
| DefinedName
the existing or new Cell instance.
Throws
Section titled “Throws”if precondition is not satisfied (the formula parser has
not finished importing), or if a string is passed and it fails to parse
as a Reference.
writes()
Section titled “writes()”writes(): [string, CellValue][];Precondition: Workbook must be initialized
Returns
Section titled “Returns”[string, CellValue][]
fromCsf()
Section titled “fromCsf()”static fromCsf( csf, model, options): Workbook;Create a Workbook from CSF format directly, bypassing JSF conversion. This provides significantly better performance than converting CSF→JSF→Workbook.
Parameters
Section titled “Parameters”Workbook data in CSF format
The Model instance to attach this workbook to
options
Section titled “options”WorkbookOptions = {}
Workbook initialization options
Returns
Section titled “Returns”Workbook
A new Workbook instance populated from CSF
fromJsf()
Section titled “fromJsf()”static fromJsf( jsf, model, options): Workbook;Create a Workbook from JSF format.
Parameters
Section titled “Parameters”JSF
Workbook data in JSF format
The Model instance to attach this workbook to
options
Section titled “options”WorkbookOptions = {}
Workbook initialization options
Returns
Section titled “Returns”Workbook
A new Workbook instance populated from JSF
fromXlsx()
Section titled “fromXlsx()”static fromXlsx( data, model, filename,options?): Promise<Workbook>;Create a Workbook from XLSX binary data.
This is a convenience method that wraps @borgar/xlsx-convert to load XLSX data
directly into a Workbook without requiring users to manually import the conversion library.
Note: This creates only the main workbook. External references in the XLSX file are not automatically added to the model. Use Model.addWorkbookFromXlsx to also add externals.
Parameters
Section titled “Parameters”Binary XLSX data (works in browsers and Node.js)
ArrayBuffer | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>
The Model instance to attach this workbook to
filename
Section titled “filename”string
Filename to associate with the workbook
options?
Section titled “options?”WorkbookOptions
Workbook initialization options
Returns
Section titled “Returns”Promise<Workbook>
A Promise resolving to a new Workbook instance
fromXlsxFile()
Section titled “fromXlsxFile()”static fromXlsxFile( path, model,options?): Promise<Workbook>;Create a Workbook from an XLSX file path.
This is a convenience method that wraps @borgar/xlsx-convert to load XLSX files
directly into a Workbook without requiring users to manually import the conversion library.
Note: This creates only the main workbook. External references in the XLSX file are not automatically added to the model. Use Model.addWorkbookFromXlsxFile to also add externals.
Parameters
Section titled “Parameters”string
Path to the XLSX file (Node.js only - uses fs)
The Model instance to attach this workbook to
options?
Section titled “options?”WorkbookOptions
Workbook initialization options
Returns
Section titled “Returns”Promise<Workbook>
A Promise resolving to a new Workbook instance