InsertRowBefore does not update named cell references

Author: William-IRMCreated Feb 9, 2026Updated Feb 11, 2026

Migrating a really old internal tool from PHPExcel to PhpSpreadsheet, I was surprised and disappointed to discover that while the old PHPExcel correctly updated named cell references when inserting/deleting rows/columns, it doesn't appear that PhpSpreadsheet does the same.

I see that cross-sheet references are also not updated automatically, due to performance concerns. Can I propose a solution? Add an additional (optional?) parameter to the various insert/delete functions to allow the user to define what to check and update. I'm thinking a series of constants, use standard binary operators to combine as desired:

  • PHPSPREADSHEET_UPDATE_NONE: for those who know there's no references and want lightning fast inserts/deletes. Useful for cloning a style.
  • PHPSPREADSHEET_UPDATE_SAME_SHEET: as the current behaviour.
  • PHPSPREADSHEET_UPDATE_OTHER_SHEETS: Specifically only update references in other sheets. Probably not useful on its own, but you never know.
  • PHPSPREADSHEET_UPDATE_NAMED_REFERENCES: Specifically only update named cells/ranges.
  • PHPSPREADSHEET_UPDATE_ALL: Combination of same sheet, other sheets, and named references.

Source: PHPOffice/PhpSpreadsheet