You are here

public function PHPExcel::getSheetByName in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel.php \PHPExcel::getSheetByName()

Get sheet by name

Parameters

string $pName Sheet name:

Return value

PHPExcel_Worksheet

3 calls to PHPExcel::getSheetByName()
PHPExcel::setActiveSheetIndexByName in vendor/phpoffice/phpexcel/Classes/PHPExcel.php
Set active sheet index by name
PHPExcel::setIndexByName in vendor/phpoffice/phpexcel/Classes/PHPExcel.php
Set index for sheet by sheet name.
PHPExcel::sheetNameExists in vendor/phpoffice/phpexcel/Classes/PHPExcel.php
Check if a sheet with a specified name already exists

File

vendor/phpoffice/phpexcel/Classes/PHPExcel.php, line 601

Class

PHPExcel
PHPExcel

Code

public function getSheetByName($pName = '') {
  $worksheetCount = count($this->_workSheetCollection);
  for ($i = 0; $i < $worksheetCount; ++$i) {
    if ($this->_workSheetCollection[$i]
      ->getTitle() === $pName) {
      return $this->_workSheetCollection[$i];
    }
  }
  return NULL;
}