iftikhar786 / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

Does not work with a specific .xls file #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Read an excel file

What is the expected output? What do you see instead?
Data of excel. 
The filename /var/www/data.xls is not readable.

What version of the product are you using? On what operating system?
Latest currently available. CentOS

Please provide any additional information below.
It work with the example file.

Error occur at this point.
if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {
            $this->error = 1;
            return false;
        }

Original issue reported on code.google.com by juslin...@gmail.com on 4 Mar 2009 at 9:30

GoogleCodeExporter commented 8 years ago
The program will read the IN xls file, but will not read the MA xls file.  
Notice
that these are VERY VERY SIMILAR excel files.  Any reason for this?

Original comment by pgjensen on 10 Mar 2009 at 7:07

Attachments:

GoogleCodeExporter commented 8 years ago
the error for above wells-MA.xls file is:

Notice: iconv() [function.iconv]: Detected an illegal character in input string 
in
C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\Private\includes\Rates\excel_reader2.php on line 
1209

Original comment by pgjensen on 10 Mar 2009 at 7:10

GoogleCodeExporter commented 8 years ago
also, it doesn't matter if it's protected or unprotected, same error is 
displayed.

Original comment by pgjensen on 10 Mar 2009 at 7:17

GoogleCodeExporter commented 8 years ago
FIXED on line 1209 of excel_reader2.php :

$result = iconv('UTF-16LE', $this->_defaultEncoding."//IGNORE", $string);

added ."//IGNORE" to ignore any characters that aren't converted right (i.e. 
the DASH
used by Microsoft products)

Original comment by pgjensen on 10 Mar 2009 at 7:46

GoogleCodeExporter commented 8 years ago
meh all that did was get rid of the notification... still won't read the file :(

Original comment by pgjensen on 10 Mar 2009 at 8:46

GoogleCodeExporter commented 8 years ago
This is beacause the file format, maybe to old... try to open it with excel an 
then
save in 2003 format... then try again...

Original comment by injektil...@gmail.com on 30 Mar 2009 at 11:30

GoogleCodeExporter commented 8 years ago
I've got the same problem, it doesn't work on some xsl files, but when I "save 
as"
them and replace the old file, it works normally. Not very convenient for the 
user,
but the most important is that it's working. (Sorry for my english)

Original comment by jfgi...@gmail.com on 7 May 2009 at 10:20

GoogleCodeExporter commented 8 years ago
Would it be possible that the problem has to do with file permissions? I had to 
make
sure that my excel files were readable by apache before it could work. You have 
to
figure out what user/group your apache or web server is using...

Original comment by keanloon...@gmail.com on 25 May 2009 at 3:39

GoogleCodeExporter commented 8 years ago
i have same problem for my xls file.please let me know the solution for the 
same ,and
i have got following error : The filename test.xls is not readable 
anyway i have enclosed the respective file for your reference

Original comment by sujith...@gmail.com on 19 Nov 2009 at 11:32

Attachments:

GoogleCodeExporter commented 8 years ago
that test.xls file is being interpreted as xml file by ms office 2003 
check if u r dealing with correct file file

Original comment by sunaramp...@gmail.com on 21 Dec 2009 at 10:32

GoogleCodeExporter commented 8 years ago
when i saved it as .xls again, it works
the file format is incorrect in your case.

Original comment by sunaramp...@gmail.com on 21 Dec 2009 at 10:33

GoogleCodeExporter commented 8 years ago
I'm using wordpress (wordpress.org) and im have the same error, but "save as" 
itsnt work.
'The filename example.xls is not readable'
Any adress work, that's include some functions like: 
get_bloginfo('template_directory').

Thanks in advance. =)

PS: My file is the same of the DEMO.(example.xls). Yeah, I update the file.

Original comment by kokerx on 26 Jan 2010 at 8:40

GoogleCodeExporter commented 8 years ago
I fixe it with ABSPATH do wordpress. The error was the wordpress dont recognize 
there
files. The example:

$arquivo = 'example'; 

$data = new Spreadsheet_Excel_Reader( ABSPATH . '/wp-content/themes/default/' .
$arquivo . '.xls');

Regards.

Original comment by miojocom...@gmail.com on 27 Jan 2010 at 7:35

GoogleCodeExporter commented 8 years ago
Hi

>>Reported by juslinguo, Mar 04, 2009
>>It work with the example file.

It really is. But in one day the example.xls crashes with 'The filename 
example.xls
'...is not readable'. I pushed update(F5) FF several times geting ~7 times 
'...is not
readable' and ~2 times dump of the example.xls. And after some time there was 
only
'...is not readable'. :)

>>Error occur at this point.
>>if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {

Yes it is. In my case substr($this->data,0,8) crushes. I made some changes that 
fix
the bag:

/*                  
if (substr ( $this->data, 0, 8 ) != IDENTIFIER_OLE) {
    $this->error = 1;
    return false;
}*/             
/*chngs*/       
$tmp_ole_id="";
for($i=0;$i<8;$i++)$tmp_ole_id.=$this->data[$i];
if ($tmp_ole_id!=IDENTIFIER_OLE){
    $mssg=$tmp_ole_id."!=".IDENTIFIER_OLE;
    return "function: ".__FUNCTION__.": <line: ".__LINE__."> ".$mssg;
}
/*chngs*/

Original comment by d...@mail.ru on 2 Mar 2010 at 2:11

GoogleCodeExporter commented 8 years ago
excuse me for prev post. After some research i`ve found that the bug(bag :) ) 
is not
so simple.

>>Error occur at this point.
>>if (substr($this->data, 0, 8) != IDENTIFIER_OLE) {

Not in my case. In my case substr($this->data, 0, 8) returning IDENTIFIER_OLE 
chars
plus some incorrect chars that not suposed to be in IDENTIFIER_OLE. example.xls 
from
package zip was used. So even if trim(substr($this->data, 0, 8))!= 
IDENTIFIER_OLE
will be passed other part of the class funcs will go crazy and endless loop in 
some
whiles is possible. Thus bug was here $this->data = @file_get_contents ( 
$sFileName
); or may be in substr usage or may be in PHP.
Finally example.php dumped the example.xls left me surprised that i`ve done 
nothing
to script except echo on some values.

keep researching...

Original comment by d...@mail.ru on 3 Mar 2010 at 12:09

GoogleCodeExporter commented 8 years ago
when you get this error:
function: Spreadsheet_Excel_Reader(data/some_file.xls): <file:
classes/php_excel_reader/excel_reader2.php> <line: 839> function: read: <line: 
904>
function: read: <line: 124> substr(this->data,0,8)!=РПаЎ±б

try using shell command:
service httpd reload

Original comment by d...@mail.ru on 10 Mar 2010 at 4:07

GoogleCodeExporter commented 8 years ago
finally found the reason:
mb_internal_encoding()==UTF-8

error happens on linux, to reproduce error try using attached file(example.xls 
same)

Original comment by d...@mail.ru on 2 Apr 2010 at 7:44

Attachments:

GoogleCodeExporter commented 8 years ago
Hi guys, i am a CS student because i have the same problem but only on web 
server(not
on localhost)could anyone provide the solution that  d...@mail.ru refers? 
Thanks in
advance!

Original comment by gregko...@gmail.com on 11 May 2010 at 2:13

GoogleCodeExporter commented 8 years ago
I need batching parser excel file, but it have problem to parser this excel
http://capital.sec.or.th/webapp/corp_fin/datafile/FS/010120100253T02.xls

any idea to fix it ?

Original comment by den...@gmail.com on 7 Jun 2010 at 8:07

GoogleCodeExporter commented 8 years ago
Hey guys! I had the same problem, and I followed that Comment 6  by 
injektilorc, and I jsut saved my .xls file into Microsoft Office Excel 2003 
format and now it works! :)

Original comment by joey_dou...@hotmail.fr on 8 Jun 2010 at 2:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
i had the same problem :
The filename XXXXX.xls is not readable.

the code works fine on my development server, but not in my production server, 
so i search in both php.ini files and i get that the only difference was the 
"mbstring extension", 
DEVELOPMENT : mbstring.func_overload = 0
PRODUCTION  : mbstring.func_overload = 7

so that was causing the problem... the solution :
- change the "internal encoding" before the read the file
line 105 :BEFORE: 
$this->data = @file_get_contents($sFileName);
line 105 :AFTER:
mb_internal_encoding('ISO-8859-1');
$this->data = @file_get_contents($sFileName);

- change UTFEncoder from "iconv" to "mb"
line 917:BEFORE:
$this->setUTFEncoder('iconv');
line 917:AFTER:
$this->setUTFEncoder('mb');

i know that it can be changed in execution time, but i prefer it as a 
definitive setting.

i hope this works for most people.

Original comment by bist...@gmail.com on 28 Oct 2010 at 6:59

GoogleCodeExporter commented 8 years ago
hi this is working for xls files , but whie uploading xlsx files its nt working 
can any one help on this

Original comment by tulasi.c...@gmail.com on 22 Sep 2011 at 10:21

GoogleCodeExporter commented 8 years ago
Thank you very much! It works!!!

Original comment by bogir...@gmail.com on 12 Jan 2012 at 7:26

GoogleCodeExporter commented 8 years ago
@bist: I use your solution but it doesn't work.
the same error:
The filename example.xls is not readable 

Original comment by banamle...@gmail.com on 18 Feb 2012 at 4:14

GoogleCodeExporter commented 8 years ago
@banamle, did you enable mb_string extension?

Original comment by bist...@gmail.com on 18 Feb 2012 at 6:15

GoogleCodeExporter commented 8 years ago
@bist: I enabled mb_string extension in php.ini
extension=php-mbstring.dll
Can you suggest other Yii extension to read excel file ?

Original comment by banamle...@gmail.com on 28 Feb 2012 at 7:54

GoogleCodeExporter commented 8 years ago
@bist, I found that my problem was when i used php-excel-reader as an extension 
in Yii. It doesn't work. I create a simple file example => It works well.

Original comment by banamle...@gmail.com on 28 Feb 2012 at 8:34

Attachments:

GoogleCodeExporter commented 8 years ago
Thats Worked !!! thanks

Hey guys! I had the same problem, and I followed that Comment 6  by 
injektilorc, and I jsut saved my .xls file into Microsoft Office Excel 2003 
format and now it works! :)

Original comment by burakgun...@gmail.com on 22 Apr 2012 at 3:24

GoogleCodeExporter commented 8 years ago
i think none of the above solution solved my problem.

Still showing that the file is not readable.

Original comment by sirinibi...@gmail.com on 11 Oct 2012 at 7:18

GoogleCodeExporter commented 8 years ago
Hi, 

It doesn't work when i upload .xlsx file. Any one suggest other solution ?

Original comment by sabyasac...@einsignia.com on 14 Dec 2012 at 5:58

GoogleCodeExporter commented 8 years ago
I tried all the solutions posted, but I still can't read the file. My XLS files 
is generated by the Excel Writer. I attached a example.

Original comment by keo...@gmail.com on 4 Mar 2013 at 1:24

Attachments:

GoogleCodeExporter commented 8 years ago
Can anyone please suggest me here.
I am doing the import and the file provided to me is giving me the error that 
it is not readable. 
When I open the file and save it again in Excel 97-2003 it works for me.

Original comment by neema.te...@gmail.com on 12 May 2014 at 9:22

GoogleCodeExporter commented 8 years ago
when i replace the new file of xls its always load the previous xls file and  
no error show. i clear all cache data.but not working..

prev- old.xls
current - new.xls

its always load old.xls. even i delete from my locaion but its load old.xls 

Original comment by sa...@softograph.com on 31 Jan 2015 at 11:41