code: public function unsetWorksheetCells()
      {
          if ($this->currentCell !== null) {
              $this->currentCell->detach();
              $this->currentCell = null;
              $this->currentCoordinate = null;
          }
  
          // Flush the cache
          $this->__destruct();
  
          $this->index = [];
  
          // detach ourself from the worksheet, so that it can then delete this object successfully
          $this->parent = null;
      }
docs: Clear the cell collection and disconnect from our parent.