Skip to content

appendSheet

On this page

Append a worksheet to the end of a workbook's sheet list.

If no name is provided, generates one automatically ("Sheet1", "Sheet2", ...). When roll is true and the name already exists, appends an incrementing numeric suffix to make it unique (e.g. "Sheet1" -> "Sheet2").

appendSheet(wb: WorkBook, ws: WorkSheet, name?: string, roll?: boolean): string

Parameters

NameTypeRequiredDescription
wbWorkBookYesThe workbook to add the sheet to
wsWorkSheetYesThe worksheet to append
namestringNoOptional sheet name; auto-generated if omitted
rollbooleanNoIf true, auto-increment the name suffix on collision instead of throwing

Returns

string

The final sheet name that was used