Skip to content

Worksheet Copy: Add hook for naming copied pivot tables during worksheet copy #2455

Description

@swmal

Background

When a worksheet containing pivot tables is copied within the same workbook, EPPlus renames each copied pivot table to a generated name (PivotTable1, PivotTable2, ...). There is currently no way for the caller to assign a meaningful name to a copied pivot table at copy time. Callers who need stable, per-instance names (e.g. stamping out per-market or per-period sheets from a template) must match generated names back to their originals afterwards, which is fragile.

Proposed change

Mirror the existing table copy hook: add a PivotTableCopyHandler to the worksheet copy options, invoked for each copied pivot table with the source name and the default assigned name, letting the caller supply a custom name. The rename routes through the ExcelPivotTable.Name setter so name uniqueness is validated. GETPIVOTDATA references are address based, so no formula adjustment is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions