I am using php-excel-reader library for import data from xls file. I am exporting xls file from CRM and when I upload it to server for import data php-excel-reader read every single cell value but I am not getting last character of string(cellvalue). Excel sheet contains special spanish character. I used iconv()
and utf8_encode()
for solve this issue but I'm still facing same issue.
Output : (Uploaded directly exported file)
[20] => Array
(
[0] =>
[1] => 34
[2] => De León Cantú, Alons
[3] => 8358-380
[4] => 09:00 PM - 09:00 AM 12/0
[5] => 33
[6] =>
[7] => Campos Duque, Maria del Rosari
[8] => (81) 8688-863
[9] =>
[10] =>
)
Other scenario : when I open xls file exported from CRM and when I save it as Save As, it's working. I don't know how this is happening?
Output : (Open and Save As before upload file)
[20] => Array
(
[0] =>
[1] => 34
[2] => De León Cantú, Alonso
[3] => 8358-3807
[4] => 09:00 PM - 09:00 AM 12/02
[5] => 33
[6] =>
[7] => Campos Duque, Maria del Rosario
[8] => (81) 8688-8632
)
This is code which I have used to read xls file.
Code :
$xl_reader = new Spreadsheet_Excel_Reader();
$xl_reader->read("reports.xls");
for($i=0;$i<$xl_reader->sheets[0]['numRows'];$i++) {
for($j=0;$j<$xl_reader->sheets[0]['numCols'];$j++){
if(!empty($xl_reader->sheets[0]['cells'][$i+1])){
$file_data[$i][$j] = $xl_reader->sheets[0]['cells'][$i+1][$j+1];
}
}
}
print_r($file_data);
exit;