Read large spreasheet

Topics: Developer Forum, Project Management Forum, User Forum
Jul 22, 2011 at 5:33 AM

I try to read a large spreasheet: 3880 rows, 39 columns ('A' to 'AM'), namely 3880*AM.

firstly, it prompts memory problem. i adjust the memory size. (actually, it is not a good way because of 1k/cell. memory consuming)

then, it takes over 60s to work out. the explorer dies after 60s.

anyone has a solution?

Jul 22, 2011 at 12:58 PM

If you need not preserve formatting, try this:


Jul 22, 2011 at 3:08 PM

or you could use set_time_limit(int sec ); you can set the processing time to any amount of seconds like 3000s=5 min of processing time so your process will now stop after 30 s :) for further details look into php manual

Jul 23, 2011 at 1:47 AM

Thanks, guys! Highly appreciate your responses.

ScottMSanders' method works, but still need to set time larger because the spreadsheet is too large.

1. Do you guys know how to go through sheet from column 'A' to 'AM'? Below program doen't work well, it just returns column 'A'.

for($j=1;$j<=$highestRow;$j++){               //$highestRow=4000
    for($k='A';$k<=$highestColumn;$k++)   //$highestColumn='AM'
        $str .= $objPHPExcel->getActiveSheet()->getCell("$k$j")->getValue()." ";
    echo $str.'<br/>';

2. Another problem with my work is to read large number. The large number like 1000203000000 is showed in spreadsheet in scientific data like 1.000203E+12, so it is read as 1.000203E+12 through phpexcel, while I want the original data like 1000203000000.

I try to use "$objPHPExcel->getActiveSheet()->getStyle("$k$j")->getNumberFormat()->setFormatCode('0'); ", but it doesn't work.

Your guys have any idea about the large number?