Help about PHPExcel implementation...

Topics: Developer Forum
Sep 14, 2009 at 4:28 PM

Hi, all...

I have a question about the implementation of this classes ... PHPExcel works for read files in XML Spreadsheet format .XLS ???

I need to read some data saved on XLS  with the structure showed below:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"

If I try to read this file using a basic approach like this I get  this error

Warning: ZipArchive::getFromName() [function.ZipArchive-getFromName]: Invalid or unitialized Zip object in E:\www\!Server_LAB\PHP_XLS\test_001\PHPExcel\Reader\Excel2007.php on line 327


$objReader = new PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load("calculo.xls");

I just need to confirm if PHPExcel is intented to read files like this .... thanks for your time

Best Regards

Sep 14, 2009 at 6:33 PM
Edited Sep 14, 2009 at 6:40 PM

XLS is the extension for Microsoft's proprietary binary format for Excel workbooks up to Excel 2003. The PHPExcel reader for this format is the Excel5 reader. However, this is not an xml based format like that you show. Excel 2007 uses an xml based format, with the XLSX extension, although it's typically zip compressed, and doesn't look much like your example. Excel 2003 also provided an XML save option, and this looks like your sample document (although normally it has an xml extension by default).

The latest subversion code for PHPExcel has the initial version of a reader for Excel 2003 XML, although this is still very much under development. At the moment, it only reads worksheet cell data and formulae, without any of the formatting.

It can be accessed using:

$objReader = new PHPExcel_Reader_Excel2003XML();
$objPHPExcel = $objReader->load("calculo.xls");

This new reader is currently work in progress, and not yet a final version. Note that it doesn't yet handle number format masks or cell formatting, although that functionality should be working within the week.

Sep 15, 2009 at 6:28 AM

Documentation for this will also appear in the code repository today.

Sep 15, 2009 at 4:46 PM


My XLS's don't have format, so may be I will give it a try.... I think that these files were saved with the "SAVE AS" option .... it have .XLS extension but XML structure...

Thank you very much MarkBaker and maartenba for your time and your help...

Best Regads