Closed (fixed)
Project:
PHPExcel
Version:
7.x-3.10
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jun 2015 at 14:19 UTC
Updated:
3 Aug 2015 at 13:04 UTC
Jump to comment: Most recent
I have following rows in excel (first row is the header)
key | value | description
aaa | | sfs
| 9.8 | fdgWhen I the read the excel and print it
$result = phpexcel_import($file_path);
watchdog("Result:", print_r($result, TRUE));
I get the following result. You can see when columns are empty it produces strange result. The headers are mapped with wrong values. How to avoid this?
[0] => Array
(
[key] => aaaa
[value] => sfs
)
[1] => Array
(
[key] => 9.8
[value] => fdg
)
Comments
Comment #1
rroblik commentedSame for me.
To come back like the previous release (phpexcel 7.x-3.9) change (line 428,
phpexcel.inc)$cells->setIterateOnlyExistingCells(TRUE);by
$cells->setIterateOnlyExistingCells(FALSE);I think this behavior should be controlled by user with a new parameter for the function
phpexcel_import(with a default value)Regards
Comment #2
adhisugha commentedThank you. let me try.
Comment #3
parasolx commentedtips #1 solve my problem also. i agree this part should be controlled by user through new parameter instead make it compulsory in module.
Comment #4
cbanman commented#1 also helped me. And I agree too that it should be added as a new parameter.
Comment #5
BartGysens commentedAn update which slipped in without noticing through GitHub... Naughty programmers ;-) but this fix worked also for me - THX!
Comment #6
cbanman commentedYeah, it's a pretty big change to make without really saying much about it. I added an issue to this module with my proposed solution a few weeks ago #2508650: Add parameter to phpexcel_import to modify $cells->setIterateOnlyExistingCells.
Comment #7
drupalmani28 commented#1 solved the problem. Thanks
Comment #8
drupalmani28 commentedComment #9
rroblik commented@manikandan.btech I'm not sure this is a
fixedissue (no new release since may ...) isn't it ?@cbanman you should link this issue in your ticket :)
Comment #10
cbanman commented@rroblik good idea. I went ahead and linked it.
Yeah, unfortunately because this module seems to be very minimally maintained, it may take a while for a fix to be implemented.
Comment #11
wadmiraal commentedHi all, thanks for the report and comments. I've been very busy lately, haven't had time to look into this. Sorry for not getting back, though.
I fixed the following in 3.10, which causes the reported issue: #2243117: Load only certain sheets and preserve column index for sparse sheets
Like said in #1, downgrade to 3.9 for now. Let me update the test suite so I can have a regression test and reproduce it, and then I'll fix and roll a new release (current tests all pass; I never make a new release without running them).
I'll keep you posted.
Comment #12
cbanman commentedAwesome, thanks for the update.
Comment #14
wadmiraal commentedFixed. On 3.11.