Skip to main content

Workbook Object

For a given workbook object wb:

wb.SheetNames is an ordered list of the sheets in the workbook.

wb.Sheets is an object whose keys are worksheet names (from SheetNames) and whose values are worksheet objects.

wb.Props is an object storing the standard properties. wb.Custprops stores custom properties. Since the XLS standard properties deviate from the XLSX standard, XLS parsing stores core properties in both places.

wb.Workbook stores workbook-level attributes.

When reading a file, wb.bookType is the determined book type.

File Properties

The various file formats use different internal names for file properties. The workbook Props object normalizes the names:

File Properties (click to hide)
JS NameExcel Description
TitleSummary tab "Title"
SubjectSummary tab "Subject"
AuthorSummary tab "Author"
ManagerSummary tab "Manager"
CompanySummary tab "Company"
CategorySummary tab "Category"
KeywordsSummary tab "Keywords"
CommentsSummary tab "Comments"
LastAuthorStatistics tab "Last saved by"
CreatedDateStatistics tab "Created"

For example, to set the workbook title property:

if(!wb.Props) wb.Props = {};
wb.Props.Title = "Insert Title Here";

Custom properties are added in the workbook Custprops object:

if(!wb.Custprops) wb.Custprops = {};
wb.Custprops["Custom Property"] = "Custom Value";

Writers will process the Props key of the options object:

/* force the Author to be "SheetJS" */
XLSX.write(wb, {Props:{Author:"SheetJS"}});

Workbook-Level Attributes

wb.Workbook stores workbook-level attributes.

Defined Names

Format Support (click to show)

Simple Defined Names: XLSX/M, XLSB, BIFF8 XLS, XLML, ODS, SYLK

Unicode Defined Names: XLSX/M, XLSB, BIFF8 XLS, XLML, ODS

Defined Name Comment: XLSX/M, XLSB, BIFF8 XLS

wb.Workbook.Names is an array of defined name objects which have the keys:

SheetName scope. Sheet Index (0 = first sheet) or null (Workbook)
NameCase-sensitive name. Standard rules apply **
RefA1-Style Reference ("Sheet1!$A$1:$D$20")
CommentComment (only applicable for XLS/XLSX/XLSB)

Excel allows two sheet-scoped defined names to share the same name. However, a sheet-scoped name cannot collide with a workbook-scope name. Workbook writers may not enforce this constraint.

Workbook Views

wb.Workbook.Views is an array of workbook view objects which have the keys:

RTLIf true, display right-to-left

Miscellaneous Workbook Properties

wb.Workbook.WBProps holds other workbook properties:

CodeNameVBA Workbook Name
date1904epoch: 0/false for 1900 system, 1/true for 1904
filterPrivacyWarn or strip personally identifying info on save