phpexcelcodeigniterphpexcelphpexcelreader

PHPexcel get highest sheet index range


I am using PHPExcel for import data from excel file. but I find some problems where the data was dynamically repeated per sheets and I wanted to take the last sheet to process. Is there any idea or method to get the highest sheet index ?


Solution

  • Get the total number of sheets:

    $sheetCount = $excelObj->getSheetCount();
    

    The last sheet index will be:

    $lastSheet = $sheetCount - 1;