Active Sheet Index By Name

Topics: Developer Forum
May 16, 2011 at 7:53 PM

Im working in something, i have the next code

$objPHPExcel->setActiveSheetIndexByName("$name");

if the $name exist in the index it works perfect, the problem come when the $name that im looking for doesnt exist.

How can i know if $name exist yes or not?

May 17, 2011 at 12:03 PM
Edited May 17, 2011 at 1:13 PM

$sheets = $objReader->listWorksheetNames($file);

$sheets will be an array of worksheet names.