How to fix memory error in codeplex phpexcel?

432 Views Asked by At

I tried to read excel file and convert it into array. But i m getting

    following error.
    Fatal error: 
    Allowed memory size of 1677721600 bytes exhausted (tried to allocate 38 bytes)
    in /var/www/import_excel/Classes/PHPExcel/Worksheet.php on line 2431

I used this following code to read

set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
include 'PHPExcel/IOFactory.php';   


    $inputFileName = $target_file; 
    try {
        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
    } catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }

error_reporting(-1);
ini_set('display_errors',1);

$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);

echo "<pre>";
print_r($allDataInSheet);
die();  

i need to get excel data as array. but the excel file has 130 columns & more than 100 rows. so when i tried to convert to array. i m getting error. but when i tried with less column and row its working. When i try with 130 column and 50+ rows getting error.

Is there available any alternative way to convert array instead of this $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); this line. Please someone advice or help me to fix this issue. Thank you

0

There are 0 best solutions below