Raza448 / php-excel-reader

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

Parsing 'General' fields of mixed types #143

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Excel Spreadsheet of mixed fields (text, float, int) but all specified as 
'General' in Excel
2. The fields look fine in Excel, but when parsed by php-excel-reader it comes 
out all jumbled
3. When I specify the type of the field correctly in Excel then 
php-excel-reader works perfectly. 

correct: 
01/01/2012  04215702194 50.00   6.14    41.90   08630890615787207995        50.00   0
incorrect: 
yyyy/mm/dd  04215  50505050.5050;50505050.5050;50  6666.66;6666.66;6   42424242.4242
;42424242.4242;42   0863089061     50505050.5050;50505050.5050;50  

[Only difference is that in Excel I have identified the fields correctly]

The problem is that I get my spreadsheet to be parsed from an incompetent 
company and they won't stick to an agreed template or detail like specifying 
field type. I simply cannot count on the column types to be specified in Excel 
and to do it myself every time defeats the point of using php-excel-reader 
(might as well just convert to csv).

Is there a way to override the automatic field identification and specify how 
php-excel-reader should interpret a column?

Original issue reported on code.google.com by michaelh...@gmail.com on 27 Feb 2012 at 9:35

Attachments:

GoogleCodeExporter commented 8 years ago
this is weirder and weirder, if I process the original excel format I get the 
garbled junk, but if I open the file in excel and then save it again (no 
changes!) it processes perfectly :-/  

So, my sample works fine. 

Original comment by michaelh...@gmail.com on 27 Feb 2012 at 1:27

GoogleCodeExporter commented 8 years ago
I have the same issue... I export an excel from data from a database, when I 
change some values in the excel all the digits in the excel are parsed as 
General[]... But when I import the exported list without editing it all works 
fine... So the issue seems to be with (changed) Excel-sheet. But what could it 
be? Somebody?

Original comment by pimdui...@gmail.com on 13 Jun 2012 at 8:15

GoogleCodeExporter commented 8 years ago
On line 835 in the function "_format_value" in the first line I returned:

return array ('string' => $ a, 'formatColor' => null);

and it worked in my case it worked.

In case:

// ADDED by Matt Kruse for better formatting
function _format_value ($ format, $ num, $ f) {

return array ('string' => $ a, 'formatColor' => null);

}

Surely the problem with other Excel files, but in my case the execel is simple 
then it did not yield problem.

Original comment by thalisso...@gmail.com on 7 Jul 2015 at 8:38