PHPExcel icon indicating copy to clipboard operation
PHPExcel copied to clipboard

Special Character issue in the PHPExcel IOFactory Excel5 reader

Open rahul9222 opened this issue 7 years ago • 0 comments

I am Importing bulk data from the Excel5 file using the PHPExcel IOFactory classes. And then Insert every row to the database table.

Issue

When Excel file column have ( ' )single quotes or ( " ) double quotes. While reading that file it convert those special char to something else. And after inserting to database it look like A’ Customer” proper value was A' Customer"

Can anyone help me with this issue.

Code

$inputFileType = 'Excel5'; $inputFileName = "file.xls";

$objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($inputFileName);

$sheetData = $objPHPExcel->getActiveSheet()->toArray();

foreach ($sheetData as $data) { ... }

rahul9222 avatar Feb 06 '18 08:02 rahul9222