PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.2k forks source link

Special Character issue in the PHPExcel IOFactory Excel5 reader #1389

Open rahul9222 opened 6 years ago

rahul9222 commented 6 years ago

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) { ... }