Matterway
    Preparing search index...

    Function insertWorksheet

    • Inserts a worksheet at a specific position relative to other sheets.

      Parameters

      • workbook: Workbook

        The ExcelJS workbook instance.

      • name: string

        The name for the new worksheet.

      • position: { before?: string | number; after?: string | number; atIndex?: number }

        The position configuration object.

      Returns Worksheet

      The newly created worksheet.

      insertWorksheet(workbook, 'NewSheet', { atIndex: 0 }); // Insert at the beginning
      insertWorksheet(workbook, 'AfterData', { after: 'Data' });
      insertWorksheet(workbook, 'BeforeSummary', { before: 'Summary' });