I want to delete sheets from an Excel2005 / Excel5 file using PHP. I am using PHPExcel-1.7.9. I am using the following code to delete Excel2007 files as follows
$exceltype="Excel2007";
$excel = PHPExcel_IOFactory::createReader($exceltype);
$excel = $excel->load("ABC.xlsx");
$count = $excel->getSheetCount();
for($i = 0; $i < $count; $i++)
{
$excel->removeSheetByIndex(0);
}
When I use it for Excel5, I get an error
Fatal error: Call to undefined method PHPExcel_Reader_Excel5::getSheetCount()
msd_2 source
share