code: public function getSheet($pIndex)
      {
          if (!isset($this->workSheetCollection[$pIndex])) {
              $numSheets = $this->getSheetCount();
  
              throw new Exception(
                  "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}."
              );
          }
  
          return $this->workSheetCollection[$pIndex];
      }
docs: Get sheet by index.
  
  @param int $pIndex Sheet index
  
  @throws Exception
  
  @return Worksheet