Call to undefined method PHPExcel_Reader_HTML::setReadDataOnly()

Topics: Developer Forum, User Forum
Jan 22, 2014 at 1:29 PM
Hello, i am trying to read from my xls file into the mysql database but the PHPExcel_IOFactory::identify($filename); is recognising it as an HTML file and not as an xls file ... so in turn the PHPExcel_Reader_HTML::setReadDataOnly() is also not working.
I dont know what to do
Jan 22, 2014 at 3:22 PM
If you are sure that the file is a xls, explicitly created a reader of this type PHPExcel_IOFactory::createReader('Excel5');
Jan 22, 2014 at 4:53 PM
Edited Jan 22, 2014 at 5:11 PM
tried doing that too but then it says 'could not recognise file type as OLE' ....something to that effect..

It made me convert the file to an xlsx file because the xls file wouldnt save changes in the current format .I again converted it back into an xls file by using the 'Save as' tab , then the PHPExcel_IOFactory::identify started recognising it as an xls file.
The new xls file thus made also started saving changes.

for whatever reason, the Reader doesn't recognise an original .xls file .

when i opened the two files (the original xls and the back-converted xls) in an editor to compare, i saw some differences ,
most notable difference: in the end of the back-converted xls file it was specifically mentioned 'Microsoft Office Excel 2003 Work' which was not in the case of the other file.
Jan 22, 2014 at 5:52 PM
If possible (without breaking any confidentiality rules that might apply to the data in the file) can you please provide this "original" xls file to test..
Jan 23, 2014 at 3:46 AM
Edited Jan 23, 2014 at 3:56 AM
I can try but is it alright if i give you a screen shot of what the editor version of the xls file looks like.

When i make some changes in this original format it says "cannot save in the current format. to save your changes, save in the latest format"
Actually, i dont have to first save it as an xlsx file after making the changes and then reconvert it . i can also 'save as' as Microsoft 97-2003 then gets recognised as an xls file.
Jan 23, 2014 at 5:13 AM
ok heres the link, nonxls.xls , this is the so called 'original' file. please help me with this. Even if it is recognised as HTML how do i read data from it . what is the equivalent function
Jan 23, 2014 at 6:47 AM
There is paleontology :-) This is an Excel file... Version 2 !
Today, PHPExcel does not support this version and I doubt that this be considered.
If your server is Windows, perhaps you can access the file by an odbc driver.
Or, more work, implement your own reader...
Jan 23, 2014 at 7:12 AM
Edited Jan 23, 2014 at 8:44 AM
Thanks LWol and Mark.
This file has been uploaded online and being synced from a local drive on the computer using allwaysync software. I have converted this file into the latest version on the localdrive , but even this file is being generated by another VB software 'oxigen'which keeps generating it in the previous version, so is ther a way out of this apart from creating my own reader.
Jan 23, 2014 at 12:17 PM
Hum... No obvious solution... Even the first version of the ODBC driver does not read this format, the minimum being Excel 3.0, which reduces the chances of finding alternatives under other platforms.
Your software does not export in another format?
The volume of files does not allow a semi-automatic solution (Excel macro)?
Jan 23, 2014 at 5:13 PM
Yes im trying to get that done. Thanks for your help! BTW How did u know it wwas version 2!
Jan 25, 2014 at 3:56 PM
I asked Excel :-) Open your file with Excel, switch to the development environment, window of execution:? ActiveWorkbook.FileFormat
Excel responds '16', look in help to find the match with the constants xlTypeFormat, this value is the Excel 2.
A first glance using a hex editor showed me that this was not a renowned CSV (common) or a DBF (no date beginning in second byte), not a classic Excel (no crossed D followed by an uppercase ï, no PK - the signature of a zip - typical of recent Excel files - 2007 +)
Jan 26, 2014 at 6:05 AM
Oh Ok! ThankYou very much LWol !!