public function removeSheetByIndex($pIndex = 0)
    {

        $numSheets = count($this->_workSheetCollection);

        if ($pIndex > $numSheets - 1) {
            throw new PHPExcel_Exception(
            	"You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
            );
        } else {
            array_splice($this->_workSheetCollection, $pIndex, 1);
        }
        // Adjust active sheet index if necessary
        if (($this->_activeSheetIndex >= $pIndex) &&
            ($pIndex > count($this->_workSheetCollection) - 1)) {
            --$this->_activeSheetIndex;
        }

    }
public function removeSheetByIndex($pIndex = 0)
    {

        $numSheets = count($this->_workSheetCollection);

        if ($pIndex > $numSheets - 1) {
            throw new PHPExcel_Exception(
            	"You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
            );
        } else {
            array_splice($this->_workSheetCollection, $pIndex, 1);
        }
        // Adjust active sheet index if necessary
        if (($this->_activeSheetIndex >= $pIndex) &&
            ($pIndex > count($this->_workSheetCollection) - 1)) {
            --$this->_activeSheetIndex;
        }

    }
public function removeSheetByIndex ( $ pIndex = 0 ) { $ numSheets = count ( $ this -> _workSheetCollection ) ; if ( $ pIndex > $ numSheets - 1 ) { throw new PHPExcel_Exception ( "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." ) ; } else { array_splice ( $ this -> _workSheetCollection , $ pIndex , 1 ) ; } // Adjust active sheet index if necessary if ( ( $ this -> _activeSheetIndex >= $ pIndex ) && ( $ pIndex > count ( $ this -> _workSheetCollection ) - 1 ) ) { -- $ this -> _activeSheetIndex ; } }
Remove sheet by index

@param  int $pIndex Active sheet index
@throws PHPExcel_Exception
Remove sheet by index