@sheetkit/node / Workbook
Class: Workbook
Defined in: index.ts:186
Excel workbook for reading and writing .xlsx files.
Constructors
Constructor
new Workbook():
Workbook
Defined in: index.ts:189
Returns
Workbook
Accessors
sheetNames
Get Signature
get sheetNames():
string[]
Defined in: index.ts:233
Get the names of all sheets in workbook order.
Returns
string[]
Methods
addChart()
addChart(
sheet,fromCell,toCell,config):void
Defined in: index.ts:457
Add a chart to a sheet.
Parameters
sheet
string
fromCell
string
toCell
string
config
Returns
void
addComment()
addComment(
sheet,config):void
Defined in: index.ts:552
Add a comment to a cell.
Parameters
sheet
string
config
Returns
void
addDataValidation()
addDataValidation(
sheet,config):void
Defined in: index.ts:522
Add a data validation rule to a sheet.
Parameters
sheet
string
config
Returns
void
addFormControl()
addFormControl(
sheet,config):void
Defined in: index.ts:492
Add a form control to a sheet.
Parameters
sheet
string
config
Returns
void
addImage()
addImage(
sheet,config):void
Defined in: index.ts:462
Add an image to a sheet.
Parameters
sheet
string
config
Returns
void
addPerson()
addPerson(
input):string
Defined in: index.ts:592
Add a person to the person list. Returns the person ID.
Parameters
input
Returns
string
addPivotTable()
addPivotTable(
config):void
Defined in: index.ts:802
Add a pivot table to the workbook.
Parameters
config
Returns
void
addShape()
addShape(
sheet,config):void
Defined in: index.ts:467
Add a shape to a sheet, anchored between two cells.
Parameters
sheet
string
config
Returns
void
addSlicer()
addSlicer(
sheet,config):void
Defined in: index.ts:847
Add a slicer to a sheet targeting a table column.
Parameters
sheet
string
config
Returns
void
addSparkline()
addSparkline(
sheet,config):void
Defined in: index.ts:817
Add a sparkline to a worksheet.
Parameters
sheet
string
config
Returns
void
addStyle()
addStyle(
style):number
Defined in: index.ts:422
Add a style definition. Returns the style ID for use with setCellStyle.
Parameters
style
Returns
number
addTable()
addTable(
sheet,config):void
Defined in: index.ts:832
Register a table in the workbook.
Parameters
sheet
string
config
Returns
void
addThreadedComment()
addThreadedComment(
sheet,cell,input):string
Defined in: index.ts:567
Add a threaded comment to a cell. Returns the comment ID.
Parameters
sheet
string
cell
string
input
Returns
string
applyStreamWriter()
applyStreamWriter(
writer):number
Defined in: index.ts:617
Apply a stream writer's output to the workbook. Returns the sheet index.
Parameters
writer
Returns
number
calculateAll()
calculateAll():
void
Defined in: index.ts:797
Recalculate all formula cells in the workbook.
Returns
void
copySheet()
copySheet(
source,target):number
Defined in: index.ts:317
Copy a sheet. Returns the new sheet's 0-based index.
Parameters
source
string
target
string
Returns
number
deleteCellHyperlink()
deleteCellHyperlink(
sheet,cell):void
Defined in: index.ts:756
Delete a hyperlink from a cell.
Parameters
sheet
string
cell
string
Returns
void
deleteChart()
deleteChart(
sheet,cell):void
Defined in: index.ts:472
Delete a chart anchored at the given cell.
Parameters
sheet
string
cell
string
Returns
void
deleteConditionalFormat()
deleteConditionalFormat(
sheet,sqref):void
Defined in: index.ts:547
Delete conditional formatting for a specific cell range.
Parameters
sheet
string
sqref
string
Returns
void
deleteCustomProperty()
deleteCustomProperty(
name):boolean
Defined in: index.ts:652
Delete a custom property. Returns true if it existed.
Parameters
name
string
Returns
boolean
deleteDefinedName()
deleteDefinedName(
name,scope?):void
Defined in: index.ts:892
Delete a defined name by name and optional scope.
Parameters
name
string
scope?
string | null
Returns
void
deleteFormControl()
deleteFormControl(
sheet,index):void
Defined in: index.ts:502
Delete a form control by index.
Parameters
sheet
string
index
number
Returns
void
deletePicture()
deletePicture(
sheet,cell):void
Defined in: index.ts:477
Delete a picture anchored at the given cell.
Parameters
sheet
string
cell
string
Returns
void
deletePivotTable()
deletePivotTable(
name):void
Defined in: index.ts:812
Delete a pivot table by name.
Parameters
name
string
Returns
void
deleteSheet()
deleteSheet(
name):void
Defined in: index.ts:307
Delete a sheet by name.
Parameters
name
string
Returns
void
deleteSlicer()
deleteSlicer(
sheet,name):void
Defined in: index.ts:857
Delete a slicer by name from a sheet.
Parameters
sheet
string
name
string
Returns
void
deleteTable()
deleteTable(
sheet,name):void
Defined in: index.ts:842
Delete a table from a sheet by name.
Parameters
sheet
string
name
string
Returns
void
deleteThreadedComment()
deleteThreadedComment(
sheet,commentId):void
Defined in: index.ts:582
Delete a threaded comment by ID.
Parameters
sheet
string
commentId
string
Returns
void
duplicateRow()
duplicateRow(
sheet,row):void
Defined in: index.ts:347
Duplicate a row (1-based).
Parameters
sheet
string
row
number
Returns
void
evaluateFormula()
evaluateFormula(
sheet,formula):string|number|boolean|DateValue|null
Defined in: index.ts:792
Evaluate a formula string against the current workbook data.
Parameters
sheet
string
formula
string
Returns
string | number | boolean | DateValue | null
fillFormula()
fillFormula(
sheet,range,formula):void
Defined in: index.ts:787
Fill a range with a formula, adjusting row references.
Parameters
sheet
string
range
string
formula
string
Returns
void
fromJSON()
fromJSON(
sheet,data,options?):void
Defined in: index.ts:1009
Write an array of JSON objects to a sheet.
Parameters
sheet
string
data
Record<string, CellValueInput>[]
options?
Returns
void
getActiveSheet()
getActiveSheet():
string
Defined in: index.ts:327
Get the name of the active sheet.
Returns
string
getAppProps()
getAppProps():
JsAppProperties
Defined in: index.ts:637
Get application properties.
Returns
getCellFormattedValue()
getCellFormattedValue(
sheet,cell):string
Defined in: index.ts:273
Get the formatted display text for a cell, applying its number format.
Parameters
sheet
string
cell
string
Returns
string
getCellHyperlink()
getCellHyperlink(
sheet,cell):JsHyperlinkInfo|null
Defined in: index.ts:751
Get hyperlink information for a cell, or null if no hyperlink exists.
Parameters
sheet
string
cell
string
Returns
JsHyperlinkInfo | null
getCellRichText()
getCellRichText(
sheet,cell):JsRichTextRun[] |null
Defined in: index.ts:867
Get rich text runs for a cell, or null if not rich text.
Parameters
sheet
string
cell
string
Returns
JsRichTextRun[] | null
getCellStyle()
getCellStyle(
sheet,cell):number|null
Defined in: index.ts:427
Get the style ID applied to a cell, or null if default.
Parameters
sheet
string
cell
string
Returns
number | null
getCellValue()
getCellValue(
sheet,cell):string|number|boolean|DateValue|null
Defined in: index.ts:268
Get the value of a cell. Returns string, number, boolean, DateValue, or null.
Parameters
sheet
string
cell
string
Returns
string | number | boolean | DateValue | null
getColOutlineLevel()
getColOutlineLevel(
sheet,col):number
Defined in: index.ts:407
Get the outline level of a column. Returns 0 if not set.
Parameters
sheet
string
col
string
Returns
number
getCols()
getCols(
sheet):JsColData[]
Defined in: index.ts:777
Get all columns with their data from a sheet.
Parameters
sheet
string
Returns
getColStyle()
getColStyle(
sheet,col):number
Defined in: index.ts:452
Get the style ID for a column. Returns 0 if not set.
Parameters
sheet
string
col
string
Returns
number
getColVisible()
getColVisible(
sheet,col):boolean
Defined in: index.ts:397
Get whether a column is visible.
Parameters
sheet
string
col
string
Returns
boolean
getColWidth()
getColWidth(
sheet,col):number|null
Defined in: index.ts:387
Get the width of a column, or null if not explicitly set.
Parameters
sheet
string
col
string
Returns
number | null
getComments()
getComments(
sheet):JsCommentConfig[]
Defined in: index.ts:557
Get all comments on a sheet.
Parameters
sheet
string
Returns
getConditionalFormats()
getConditionalFormats(
sheet):JsConditionalFormatEntry[]
Defined in: index.ts:542
Get all conditional formatting rules for a sheet.
Parameters
sheet
string
Returns
getCustomProperty()
getCustomProperty(
name):string|number|boolean|null
Defined in: index.ts:647
Get a custom property value, or null if not found.
Parameters
name
string
Returns
string | number | boolean | null
getDataValidations()
getDataValidations(
sheet):JsDataValidationConfig[]
Defined in: index.ts:527
Get all data validations on a sheet.
Parameters
sheet
string
Returns
getDefinedName()
getDefinedName(
name,scope?):JsDefinedNameInfo|null
Defined in: index.ts:882
Get a defined name by name and optional scope.
Parameters
name
string
scope?
string | null
Returns
JsDefinedNameInfo | null
getDefinedNames()
getDefinedNames():
JsDefinedNameInfo[]
Defined in: index.ts:887
Get all defined names in the workbook.
Returns
getDocProps()
getDocProps():
JsDocProperties
Defined in: index.ts:627
Get core document properties.
Returns
getFormat()
getFormat():
string
Defined in: index.ts:1051
Get the workbook format ("xlsx", "xlsm", "xltx", "xltm", "xlam").
Returns
string
getFormControls()
getFormControls(
sheet):JsFormControlInfo[]
Defined in: index.ts:497
Get all form controls on a sheet.
Parameters
sheet
string
Returns
getHeaderFooter()
getHeaderFooter(
sheet):JsHeaderFooter
Defined in: index.ts:716
Get the header and footer text for a sheet.
Parameters
sheet
string
Returns
getMergeCells()
getMergeCells(
sheet):string[]
Defined in: index.ts:517
Get all merged cell ranges on a sheet.
Parameters
sheet
string
Returns
string[]
getPageBreaks()
getPageBreaks(
sheet):number[]
Defined in: index.ts:741
Get all row page break positions (1-based row numbers).
Parameters
sheet
string
Returns
number[]
getPageMargins()
getPageMargins(
sheet):JsPageMargins
Defined in: index.ts:692
Get page margins for a sheet. Returns defaults if not explicitly set.
Parameters
sheet
string
Returns
getPageSetup()
getPageSetup(
sheet):JsPageSetup
Defined in: index.ts:702
Get the page setup for a sheet.
Parameters
sheet
string
Returns
getPanes()
getPanes(
sheet):string|null
Defined in: index.ts:682
Get the current freeze pane cell reference for a sheet, or null if none.
Parameters
sheet
string
Returns
string | null
getPersons()
getPersons():
JsPersonData[]
Defined in: index.ts:597
Get all persons in the person list.
Returns
getPictureCells()
getPictureCells(
sheet):string[]
Defined in: index.ts:487
Get all cells that have pictures anchored to them on the given sheet.
Parameters
sheet
string
Returns
string[]
getPictures()
getPictures(
sheet,cell):JsPictureInfo[]
Defined in: index.ts:482
Get all pictures anchored at the given cell.
Parameters
sheet
string
cell
string
Returns
getPivotTables()
getPivotTables():
JsPivotTableInfo[]
Defined in: index.ts:807
Get all pivot tables in the workbook.
Returns
getPrintOptions()
getPrintOptions(
sheet):JsPrintOptions
Defined in: index.ts:726
Get print options for a sheet.
Parameters
sheet
string
Returns
getRowHeight()
getRowHeight(
sheet,row):number|null
Defined in: index.ts:357
Get the height of a row, or null if not explicitly set.
Parameters
sheet
string
row
number
Returns
number | null
getRowOutlineLevel()
getRowOutlineLevel(
sheet,row):number
Defined in: index.ts:377
Get the outline level of a row. Returns 0 if not set.
Parameters
sheet
string
row
number
Returns
number
getRows()
getRows(
sheet):JsRowData[]
Defined in: index.ts:761
Get all rows with their data from a sheet using buffer-based transfer.
Parameters
sheet
string
Returns
getRowsBuffer()
getRowsBuffer(
sheet):Buffer
Defined in: index.ts:767
Serialize a sheet's cell data into a compact binary buffer.
Parameters
sheet
string
Returns
Buffer
getRowStyle()
getRowStyle(
sheet,row):number
Defined in: index.ts:442
Get the style ID for a row. Returns 0 if not set.
Parameters
sheet
string
row
number
Returns
number
getRowVisible()
getRowVisible(
sheet,row):boolean
Defined in: index.ts:367
Get whether a row is visible.
Parameters
sheet
string
row
number
Returns
boolean
getSheetIndex()
getSheetIndex(
name):number|null
Defined in: index.ts:322
Get the 0-based index of a sheet, or null if not found.
Parameters
name
string
Returns
number | null
getSheetViewOptions()
getSheetViewOptions(
sheet):JsSheetViewOptions
Defined in: index.ts:1061
Get sheet view options.
Parameters
sheet
string
Returns
getSheetVisibility()
getSheetVisibility(
sheet):string
Defined in: index.ts:1071
Get sheet visibility. Returns "visible", "hidden", or "veryHidden".
Parameters
sheet
string
Returns
string
getSlicers()
getSlicers(
sheet):JsSlicerInfo[]
Defined in: index.ts:852
Get all slicers on a sheet.
Parameters
sheet
string
Returns
getSparklines()
getSparklines(
sheet):JsSparklineConfig[]
Defined in: index.ts:822
Get all sparklines for a worksheet.
Parameters
sheet
string
Returns
getTables()
getTables(
sheet):JsTableInfo[]
Defined in: index.ts:837
Get all tables on a sheet.
Parameters
sheet
string
Returns
getThemeColor()
getThemeColor(
index,tint?):string|null
Defined in: index.ts:872
Resolve a theme color by index (0-11) with optional tint.
Parameters
index
number
tint?
number | null
Returns
string | null
getThreadedComments()
getThreadedComments(
sheet):JsThreadedCommentData[]
Defined in: index.ts:572
Get all threaded comments on a sheet.
Parameters
sheet
string
Returns
getThreadedCommentsByCell()
getThreadedCommentsByCell(
sheet,cell):JsThreadedCommentData[]
Defined in: index.ts:577
Get threaded comments for a specific cell on a sheet.
Parameters
sheet
string
cell
string
Returns
getVbaModules()
getVbaModules():
JsVbaProject|null
Defined in: index.ts:1086
Extract VBA module source code from the workbook's VBA project. Returns null if no VBA project.
Returns
JsVbaProject | null
getVbaProject()
getVbaProject():
Buffer<ArrayBufferLike> |null
Defined in: index.ts:1081
Get the raw VBA project binary (xl/vbaProject.bin), or null if not present.
Returns
Buffer<ArrayBufferLike> | null
insertCols()
insertCols(
sheet,col,count):void
Defined in: index.ts:412
Insert empty columns starting at the given column letter.
Parameters
sheet
string
col
string
count
number
Returns
void
insertPageBreak()
insertPageBreak(
sheet,row):void
Defined in: index.ts:731
Insert a horizontal page break before the given 1-based row.
Parameters
sheet
string
row
number
Returns
void
insertRows()
insertRows(
sheet,startRow,count):void
Defined in: index.ts:337
Insert empty rows starting at the given 1-based row number.
Parameters
sheet
string
startRow
number
count
number
Returns
void
isSheetProtected()
isSheetProtected(
sheet):boolean
Defined in: index.ts:907
Check if a sheet is protected.
Parameters
sheet
string
Returns
boolean
isWorkbookProtected()
isWorkbookProtected():
boolean
Defined in: index.ts:667
Check if the workbook is protected.
Returns
boolean
mergeCells()
mergeCells(
sheet,topLeft,bottomRight):void
Defined in: index.ts:507
Merge a range of cells on a sheet.
Parameters
sheet
string
topLeft
string
bottomRight
string
Returns
void
newSheet()
newSheet(
name):number
Defined in: index.ts:302
Create a new empty sheet. Returns the 0-based sheet index.
Parameters
name
string
Returns
number
newStreamWriter()
newStreamWriter(
sheetName):JsStreamWriter
Defined in: index.ts:612
Create a new stream writer for a new sheet.
Parameters
sheetName
string
Returns
protectSheet()
protectSheet(
sheet,config?):void
Defined in: index.ts:897
Protect a sheet with optional password and permission settings.
Parameters
sheet
string
config?
JsSheetProtectionConfig | null
Returns
void
protectWorkbook()
protectWorkbook(
config):void
Defined in: index.ts:657
Protect the workbook structure/windows with optional password.
Parameters
config
Returns
void
removeAutoFilter()
removeAutoFilter(
sheet):void
Defined in: index.ts:607
Remove the auto-filter from a sheet.
Parameters
sheet
string
Returns
void
removeCol()
removeCol(
sheet,col):void
Defined in: index.ts:417
Remove a column by letter.
Parameters
sheet
string
col
string
Returns
void
removeComment()
removeComment(
sheet,cell):void
Defined in: index.ts:562
Remove a comment from a cell.
Parameters
sheet
string
cell
string
Returns
void
removeDataValidation()
removeDataValidation(
sheet,sqref):void
Defined in: index.ts:532
Remove a data validation by sqref.
Parameters
sheet
string
sqref
string
Returns
void
removePageBreak()
removePageBreak(
sheet,row):void
Defined in: index.ts:736
Remove a horizontal page break at the given 1-based row.
Parameters
sheet
string
row
number
Returns
void
removeRow()
removeRow(
sheet,row):void
Defined in: index.ts:342
Remove a row (1-based).
Parameters
sheet
string
row
number
Returns
void
removeSparkline()
removeSparkline(
sheet,location):void
Defined in: index.ts:827
Remove a sparkline by its location cell reference.
Parameters
sheet
string
location
string
Returns
void
renderToSvg()
renderToSvg(
options):string
Defined in: index.ts:1076
Render a worksheet to an SVG string.
Parameters
options
Returns
string
resolveThreadedComment()
resolveThreadedComment(
sheet,commentId,done):void
Defined in: index.ts:587
Set the resolved (done) state of a threaded comment.
Parameters
sheet
string
commentId
string
done
boolean
Returns
void
save()
save(
path):Promise<void>
Defined in: index.ts:243
Save the workbook to a .xlsx file asynchronously.
Parameters
path
string
Returns
Promise<void>
saveSync()
saveSync(
path):void
Defined in: index.ts:238
Save the workbook to a .xlsx file.
Parameters
path
string
Returns
void
saveWithPassword()
saveWithPassword(
path,password):Promise<void>
Defined in: index.ts:263
Save the workbook as an encrypted .xlsx file asynchronously.
Parameters
path
string
password
string
Returns
Promise<void>
saveWithPasswordSync()
saveWithPasswordSync(
path,password):void
Defined in: index.ts:258
Save the workbook as an encrypted .xlsx file.
Parameters
path
string
password
string
Returns
void
setActiveSheet()
setActiveSheet(
name):void
Defined in: index.ts:332
Set the active sheet by name.
Parameters
name
string
Returns
void
setAppProps()
setAppProps(
props):void
Defined in: index.ts:632
Set application properties (company, app version, etc.).
Parameters
props
Returns
void
setAutoFilter()
setAutoFilter(
sheet,range):void
Defined in: index.ts:602
Set an auto-filter on a sheet.
Parameters
sheet
string
range
string
Returns
void
setCellFormula()
setCellFormula(
sheet,cell,formula):void
Defined in: index.ts:782
Set a formula on a cell.
Parameters
sheet
string
cell
string
formula
string
Returns
void
setCellHyperlink()
setCellHyperlink(
sheet,cell,opts):void
Defined in: index.ts:746
Set a hyperlink on a cell.
Parameters
sheet
string
cell
string
opts
Returns
void
setCellRichText()
setCellRichText(
sheet,cell,runs):void
Defined in: index.ts:862
Set a cell to a rich text value with multiple formatted runs.
Parameters
sheet
string
cell
string
runs
Returns
void
setCellStyle()
setCellStyle(
sheet,cell,styleId):void
Defined in: index.ts:432
Apply a style ID to a cell.
Parameters
sheet
string
cell
string
styleId
number
Returns
void
setCellValue()
setCellValue(
sheet,cell,value):void
Defined in: index.ts:278
Set the value of a cell. Pass string, number, boolean, DateValue, or null to clear.
Parameters
sheet
string
cell
string
value
CellValueInput
Returns
void
setCellValues()
setCellValues(
sheet,cells):void
Defined in: index.ts:283
Set multiple cell values at once.
Parameters
sheet
string
cells
Returns
void
setColOutlineLevel()
setColOutlineLevel(
sheet,col,level):void
Defined in: index.ts:402
Set the outline level of a column (0-7).
Parameters
sheet
string
col
string
level
number
Returns
void
setColStyle()
setColStyle(
sheet,col,styleId):void
Defined in: index.ts:447
Apply a style ID to an entire column.
Parameters
sheet
string
col
string
styleId
number
Returns
void
setColVisible()
setColVisible(
sheet,col,visible):void
Defined in: index.ts:392
Set whether a column is visible.
Parameters
sheet
string
col
string
visible
boolean
Returns
void
setColWidth()
setColWidth(
sheet,col,width):void
Defined in: index.ts:382
Set the width of a column (e.g., "A", "B", "AA").
Parameters
sheet
string
col
string
width
number
Returns
void
setConditionalFormat()
setConditionalFormat(
sheet,sqref,rules):void
Defined in: index.ts:537
Set conditional formatting rules on a cell range.
Parameters
sheet
string
sqref
string
rules
Returns
void
setCustomProperty()
setCustomProperty(
name,value):void
Defined in: index.ts:642
Set a custom property. Value can be string, number, or boolean.
Parameters
name
string
value
string | number | boolean
Returns
void
setDefinedName()
setDefinedName(
config):void
Defined in: index.ts:877
Add or update a defined name.
Parameters
config
Returns
void
setDocProps()
setDocProps(
props):void
Defined in: index.ts:622
Set core document properties (title, creator, etc.).
Parameters
props
Returns
void
setHeaderFooter()
setHeaderFooter(
sheet,header?,footer?):void
Defined in: index.ts:707
Set header and footer text for printing.
Parameters
sheet
string
header?
string | null
footer?
string | null
Returns
void
setPageMargins()
setPageMargins(
sheet,margins):void
Defined in: index.ts:687
Set page margins on a sheet (values in inches).
Parameters
sheet
string
margins
Returns
void
setPageSetup()
setPageSetup(
sheet,setup):void
Defined in: index.ts:697
Set page setup options (paper size, orientation, scale, fit-to-page).
Parameters
sheet
string
setup
Returns
void
setPanes()
setPanes(
sheet,cell):void
Defined in: index.ts:672
Set freeze panes on a sheet.
Parameters
sheet
string
cell
string
Returns
void
setPrintOptions()
setPrintOptions(
sheet,opts):void
Defined in: index.ts:721
Set print options on a sheet.
Parameters
sheet
string
opts
Returns
void
setRowHeight()
setRowHeight(
sheet,row,height):void
Defined in: index.ts:352
Set the height of a row (1-based).
Parameters
sheet
string
row
number
height
number
Returns
void
setRowOutlineLevel()
setRowOutlineLevel(
sheet,row,level):void
Defined in: index.ts:372
Set the outline level of a row (0-7).
Parameters
sheet
string
row
number
level
number
Returns
void
setRowStyle()
setRowStyle(
sheet,row,styleId):void
Defined in: index.ts:437
Apply a style ID to an entire row.
Parameters
sheet
string
row
number
styleId
number
Returns
void
setRowValues()
setRowValues(
sheet,row,startCol,values):void
Defined in: index.ts:288
Set values in a single row starting from the given column.
Parameters
sheet
string
row
number
startCol
string
values
CellValueInput[]
Returns
void
setRowVisible()
setRowVisible(
sheet,row,visible):void
Defined in: index.ts:362
Set whether a row is visible.
Parameters
sheet
string
row
number
visible
boolean
Returns
void
setSheetData()
setSheetData(
sheet,data,startCell?):void
Defined in: index.ts:293
Set a block of cell values from a 2D array.
Parameters
sheet
string
data
CellValueInput[][]
startCell?
string | null
Returns
void
setSheetDataBuffer()
setSheetDataBuffer(
sheet,buf,startCell?):void
Defined in: index.ts:772
Apply cell data from a binary buffer to a sheet.
Parameters
sheet
string
buf
Buffer
startCell?
string | null
Returns
void
setSheetName()
setSheetName(
oldName,newName):void
Defined in: index.ts:312
Rename a sheet.
Parameters
oldName
string
newName
string
Returns
void
setSheetViewOptions()
setSheetViewOptions(
sheet,opts):void
Defined in: index.ts:1056
Set sheet view options (gridlines, zoom, view mode, etc.).
Parameters
sheet
string
opts
Returns
void
setSheetVisibility()
setSheetVisibility(
sheet,visibility):void
Defined in: index.ts:1066
Set sheet visibility ("visible", "hidden", or "veryHidden").
Parameters
sheet
string
visibility
string
Returns
void
toCSV()
toCSV(
sheet,options?):string
Defined in: index.ts:947
Convert sheet data to a CSV string.
Parameters
sheet
string
options?
Returns
string
toHTML()
toHTML(
sheet,options?):string
Defined in: index.ts:987
Convert sheet data to an HTML table string.
Parameters
sheet
string
options?
Returns
string
toJSON()
toJSON(
sheet,options?):Record<string,CellValue>[]
Defined in: index.ts:912
Convert sheet data to an array of JSON objects.
Parameters
sheet
string
options?
Returns
Record<string, CellValue>[]
unmergeCell()
unmergeCell(
sheet,reference):void
Defined in: index.ts:512
Remove a merged cell range from a sheet.
Parameters
sheet
string
reference
string
Returns
void
unprotectSheet()
unprotectSheet(
sheet):void
Defined in: index.ts:902
Remove sheet protection.
Parameters
sheet
string
Returns
void
unprotectWorkbook()
unprotectWorkbook():
void
Defined in: index.ts:662
Remove workbook protection.
Returns
void
unsetPanes()
unsetPanes(
sheet):void
Defined in: index.ts:677
Remove any freeze or split panes from a sheet.
Parameters
sheet
string
Returns
void
writeBuffer()
writeBuffer():
Promise<Buffer<ArrayBufferLike>>
Defined in: index.ts:253
Serialize the workbook to an in-memory Buffer asynchronously.
Returns
Promise<Buffer<ArrayBufferLike>>
writeBufferSync()
writeBufferSync():
Buffer
Defined in: index.ts:248
Serialize the workbook to an in-memory Buffer.
Returns
Buffer
open()
staticopen(path,options?):Promise<Workbook>
Defined in: index.ts:205
Open an existing .xlsx file from disk asynchronously.
Parameters
path
string
options?
JsOpenOptions | null
Returns
Promise<Workbook>
openBuffer()
staticopenBuffer(data,options?):Promise<Workbook>
Defined in: index.ts:215
Open a workbook from an in-memory Buffer asynchronously.
Parameters
data
Buffer
options?
JsOpenOptions | null
Returns
Promise<Workbook>
openBufferSync()
staticopenBufferSync(data,options?):Workbook
Defined in: index.ts:210
Open a workbook from an in-memory Buffer.
Parameters
data
Buffer
options?
JsOpenOptions | null
Returns
Workbook
openSync()
staticopenSync(path,options?):Workbook
Defined in: index.ts:200
Open an existing .xlsx file from disk.
Parameters
path
string
options?
JsOpenOptions | null
Returns
Workbook
openWithPassword()
staticopenWithPassword(path,password):Promise<Workbook>
Defined in: index.ts:228
Open an encrypted .xlsx file using a password asynchronously.
Parameters
path
string
password
string
Returns
Promise<Workbook>
openWithPasswordSync()
staticopenWithPasswordSync(path,password):Workbook
Defined in: index.ts:223
Open an encrypted .xlsx file using a password.
Parameters
path
string
password
string
Returns
Workbook