How to set column value contain non-ascii

Topics: Developer Forum
Sep 24, 2016 at 12:17 PM
Hy, i am new in using phpexcel.

currently my system using mass upload data to the database, and mostly the data is copy and paste in to excel. File type mass upload is comma separated value. so their is high possible contain of non ascii value inside the column.

So i am using phpexcel to generate the data fail insert into database.
but the problem is that, some of the data column contain false because the data contain non ascii,
so how to set the column value same as what i upload file.!

this is the file i upload

this is error data

from the image we can see that "Address" column contain value is False. i want that column contain value same as what i upload instead of FALSE.
Sep 24, 2016 at 3:21 PM
If you know what charset the csv file is using, then tell the PHPExcel Reader that using the Reader's setInputEncoding() method before calling the load(); otherwise PHPExcel assumes that it's UTF-8
Sep 26, 2016 at 2:09 AM
$filename = date('H-i-s')."_fail_sp";
    /** Error reporting */

    /** Include path **/
    ini_set('include_path', ini_get('include_path').';../Classes/');

    /** PHPExcel */
    include 'library/PHPExcel/Classes/PHPExcel.php';

    /** PHPExcel_Writer_Excel2007 */
    include 'library/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php';

    // Create new PHPExcel object
    $objPHPExcel = new PHPExcel();
    // Set properties
    $objPHPExcel->getProperties()->setCreator("LookP Team");
    $objPHPExcel->getProperties()->setLastModifiedBy("LookP Team");
    $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Mass Upload Fail SP download");
    $objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
    $objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");

    $worksheet = $objPHPExcel->getActiveSheet();

    foreach($error_businessInfo as $row => $columns) {
        foreach($columns as $column => $data) {
            $worksheet->setCellValueByColumnAndRow($column, $row + 1, $data);

    // Rename sheet

    // Save Excel 2007 file
    $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);


this is my code section, i am not sure where should i put the "setinputencoding". the file i upload is type "Windows-1252" and i wanna produce file "Windows-1252"