Hi I want to parse an excel file using zend framework. I went to Zend Developer Zone and found a solution to download phpexcelreader. I downloaded the code set a project at localhost and run the code. When I treid to read an .xlsx
file it generates an error
The filename feed1.xlsx is not readable
I saved the file in .xls
format and run the code parsed the file successfully. Now I want to implement this in my project developed in Zend framework
. I created a model, and in my project and require_once
ed the excelreader at top of my project like this.
require_once 'Excelreader/Excel/reader.php';
class ExcelreaderModel extends Zend_Db_Table
{
function readFile()
{
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('CP1251');
//$data->read('Excelreader/Excel/feed1.xls');
$data->read('feed1.xls');
echo '<pre>';
print_r($data);
echo '</pre>';
}
}
I called this model function in my controller. But it is generating the same error which I found on localhost using .xlsx
files. But I am reading .xls
file which is parsed by the code running at simple project on localhost.I am also running zend framework at local.
What is wrong in my code? Or is there any way to do the same task.?
I think problem is in encoding type of .xlxs
file rather in setting file permission. If you change the permission it will not work for you. Problem is in OLE_IDENTIFIER (��ࡱ�)
.
So your file data must start with ��ࡱ�
data. Even I am looking for proper solution for this. Can any one help ??
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With