Question


I am using PHPExcelReader to read uploaded xls file. But I am not able to read xlsx files saved in excel-2007 format. can someone help me on how to read xlsx file in PHP.

i have also tried PHPEXCEL , here is main code

$fileName = 'test.xlsx';
try {
    $objPHPExcel = PHPExcel_IOFactory::load($fileName);
} catch (Exception $e) {
    die("Error loading file: ".$e->getMessage()."<br />\n");
}

but it gives fatal error

Fatal error: Class 'ZipArchive' not found in C:\Program Files\VertrigoServ\www\xls_reader\Classes\PHPExcel\Shared\File.php on line 53

Note: i m using Vertrigo server which have PHP Version 5.2.6

Please somebody tell me how to read xls as well as xlsx file with any suitable example or link.
Thank you very very much

Was it helpful?

Solution

For EXCEL 2007 document you need the ZipArchive extension which is obviosly not available at your system. If you enable/install this extension you will be fine.

Have a look at this link

@diEcho: I don't develop on a windows machine so I'm afraid I can't help you with that. What I do remember from my Windows experience, i used to use XAMPP for it instead and that worked for me.

OTHER TIPS

It appears that the actual question is how to enable the Zip extension under PHP/5.2 in a PHP setup installed from a zipped release. First you have find the php.ini file. You can learn its location by running this code:

<?php phpinfo(); ?>

Open the file with your favourte text editor and find this line:

;extension=php_zip.dll

Remove the leading semicollon:

extension=php_zip.dll

Restart Apache and you're done.

In PHP/5.3 the extension is already built-in.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top