I am using phpExcel, and I can't find anything to check if a sheet exists. What I would like to accomplish is something like this:
if(!$excel->sheetExists(1)){
$excel->createSheet(1);
$sheet = $excel->setSheet(1);
}
// Do some stuff with the sheet
So. My question: How can I check if a sheet exists?
Edit
Would this work?
try{
$sheet = $this->excel->setActiveSheetIndex(1);
}catch(Exception $e){
$excel->createSheet(1);
$sheet = $excel->setActiveSheetIndex(1);
}