Skip to content

Function: getWorksheetIndex()

ts
function getWorksheetIndex(workbook: Workbook, query: string | RegExp): number;

Defined in: src/excel/excel.tsx:452

Get the zero-based index of a worksheet by name or pattern.

Parameters

ParameterTypeDescription
workbookWorkbookThe ExcelJS workbook instance.
querystring | RegExpThe worksheet name or RegExp pattern.

Returns

number

The zero-based index, or -1 if not found.

Example

ts
const idx = getWorksheetIndex(workbook, 'Invoices');
const idx2 = getWorksheetIndex(workbook, /^Data/);

Matterway Assistant SDK Documentation