code: public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = '')
      {
          if ($oldName == '') {
              return;
          }
  
          foreach ($spreadsheet->getWorksheetIterator() as $sheet) {
              foreach ($sheet->getCoordinates(false) as $coordinate) {
                  $cell = $sheet->getCell($coordinate);
                  if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) {
                      $formula = $cell->getValue();
                      if (strpos($formula, $oldName) !== false) {
                          $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
                          $formula = str_replace($oldName . '!', $newName . '!', $formula);
                          $cell->setValueExplicit($formula, DataType::TYPE_FORMULA);
                      }
                  }
              }
          }
      }
docs: Update named formulas (i.e. containing worksheet references / named ranges).
  
  @param Spreadsheet $spreadsheet Object to update
  @param string $oldName Old name (name to replace)
  @param string $newName New name