Show more of an Excel worksheet

Topics: Developer Forum, Project Management Forum, User Forum
Jan 22, 2014 at 10:33 AM
Good Morning, I would like to know how do I display more than one worksheet excel with PHPExcel. I have the following code which shows only the first sheet of my file.

$ objReader = PHPExcel_IOFactory :: CreateReader ('Excel2007');
$ objReader-> setReadDataOnly (true);
$ $ = objPHPExcel objReader-> load ("Test.xlsx");
$ $ = objWorksheet objPHPExcel-> getActiveSheet ();
$ $ = highestRow objWorksheet-> getHighestRow ();
$ $ = highestColumn objWorksheet-> getHighestColumn ();
highestColumnIndex $ :: = PHPExcel_Cell columnIndexFromString ($ highestColumn);

for ($ row = 6, $ row <$ highestRow; $ row + +) {
   for ($ col = 0; $ col <= 1; $ col + +) {
     $ objWorksheet-> getCellByColumnAndRow ($ col, $ row) -> getValue ();
   }

I wonder how to show the other sheets in my file?

Thank you.
Jan 22, 2014 at 3:02 PM
You can use $objPHPExcel->getSheet($Index) or $objPHPExcel->getSheetByName($Name) to have others sheets. Use getSheetCount() or getSheetNames() to known max index or names in the workbook.
Marked as answer by FelipeAP on 1/22/2014 at 9:27 AM