Menu

#46 Problem with Big File. Need "read in parts"

open
nobody
5
2006-09-05
2006-09-05
Anonymous
No

I have a huge problem. I love your program absolutely
dude. Except for one thing.

I have an XLS File with one worksheet, 65000 records at
approx 60Mb+.

I set Max post size to 100mb and memory limit is not a
problem. I have just set the set_time_limit to 20
minutes but this doesn't work(never completes or
generates a timeout error, oddly enough) and
furthermore is highly dangerous.

Basically what I'm saying is perhaps you can write a
feature to allow a person to read rows X to Y instead
of reading the whole file.

Discussion

  • David Zschille

    David Zschille - 2006-11-23

    Logged In: YES
    user_id=1601602
    Originator: NO

    I have the same problem: Have a XLS file with 10000 Records and a size of 8 MB. The reader never finishs reading and also gives no error messages or time outs.

    Would be great if there will be a solution for big files.

     
  • David Zschille

    David Zschille - 2006-11-23

    Logged In: YES
    user_id=1601602
    Originator: NO

    Sorry! The reason for the described error was me. I let running my script in eclipse. Now i tried it in XAMPP and i could see the output in the browser.

    So it was not a problem of the PHP-Excel-Reader!

    Regards,
    David

     
  • David Fletcher

    David Fletcher - 2007-09-04

    Logged In: YES
    user_id=577267
    Originator: NO

    I made changes to allow a limit on how many cells are read. Any extra data currently gets dumped in the last 'allowed' column or row, but could just as easily be thrown away.

    Add to reader.php these definitions (with the number of rows and columns you want:

    define('MAXROW', 200);
    define('MAXCOL', 8);

    In the addcell function (around line 974 in reader), the original looks like this:

    $this->sheets[$this->sn]['maxrow'] = max($this->sheets[$this->sn]['maxrow'], $row + $this->_rowoffset);

    $this->sheets[$this->sn]['maxcol'] = max($this->sheets[$this->sn]['maxcol'], $col + $this->_coloffset);

    $this->sheets[$this->sn]['cells'][$row + $this->_rowoffset][$col + $this->_coloffset] = $string;

    Change to this:

    $limitedRow = min($row + $this->_rowoffset, MAXROW);
    $limitedCol = min($col + $this->_coloffset, MAXCOL);
    $this->sheets[$this->sn]['maxrow'] = max($this->sheets[$this->sn]['maxrow'], $limitedRow);
    $this->sheets[$this->sn]['maxcol'] = max($this->sheets[$this->sn]['maxcol'], $limitedCol);
    $this->sheets[$this->sn]['cells'][$limitedRow][$limitedCol] = $string;

    This would also be a good place to introduce filtering of the $string, or to limit its length before assigning it to the main data array.

     

Log in to post a comment.