phpexcelphpexcel-1.8.0

How to keep the cell references from another sheet updated when adding new rows with PHPExcel


After using insertNewRowBefore method from the PHPExcel 1.8.0 library, the cell references defined in the active sheet (i.e. sheet1) are correctly updated. However the cell references from the other sheets (e.g. sheet1!A10) remain unchanged.

Is there a way to update them as well?


Solution

  • No there isn't.

    The logic that updates the cell references in the same worksheet is heavily intensive and slow, and we implemented a trade-off rather than execute it for all worksheets, adding a very big overhead. It can be executed manually using an adaptation of the logic from the PHPExcel_ReferenceHelper::insertNewBefore() and related methods