Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php
public function removeColumn($pColumn, $pNumCols = 1)
    {
        if (!is_numeric($pColumn)) {
            $highestColumn = $this->getHighestDataColumn();
            $pColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($pColumn) + $pNumCols);
            $objReferenceHelper = ReferenceHelper::getInstance();
            $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
            for ($c = 0; $c < $pNumCols; ++$c) {
                $this->getCellCollection()->removeColumn($highestColumn);
                $highestColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($highestColumn) - 1);
            }
        } else {
            throw new Exception('Column references should not be numeric.');
        }

        return $this;
    }
public function removeColumn($pColumn, $pNumCols = 1)
    {
        if (!is_numeric($pColumn)) {
            $highestColumn = $this->getHighestDataColumn();
            $pColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($pColumn) + $pNumCols);
            $objReferenceHelper = ReferenceHelper::getInstance();
            $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
            for ($c = 0; $c < $pNumCols; ++$c) {
                $this->getCellCollection()->removeColumn($highestColumn);
                $highestColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($highestColumn) - 1);
            }
        } else {
            throw new Exception('Column references should not be numeric.');
        }

        return $this;
    }
public function removeColumn ( $ pColumn , $ pNumCols = 1 ) { if ( ! is_numeric ( $ pColumn ) ) { $ highestColumn = $ this -> getHighestDataColumn ( ) ; $ pColumn = Coordinate :: stringFromColumnIndex ( Coordinate :: columnIndexFromString ( $ pColumn ) + $ pNumCols ) ; $ objReferenceHelper = ReferenceHelper :: getInstance ( ) ; $ objReferenceHelper -> insertNewBefore ( $ pColumn . '1' , - $ pNumCols , 0 , $ this ) ; for ( $ c = 0 ; $ c < $ pNumCols ; ++ $ c ) { $ this -> getCellCollection ( ) -> removeColumn ( $ highestColumn ) ; $ highestColumn = Coordinate :: stringFromColumnIndex ( Coordinate :: columnIndexFromString ( $ highestColumn ) - 1 ) ; } } else { throw new Exception ( 'Column references should not be numeric.' ) ; } return $ this ; }
Remove a column, updating all possible related data.

@param string $pColumn Remove starting with this one, eg: 'A'
@param int $pNumCols Number of columns to remove

@throws Exception

@return Worksheet
Remove a column updating all possible related data .