Reader+Writer: Disable style & precalculation

Topics: Developer Forum
Oct 14, 2010 at 12:33 AM

Hi,

 

I've got some xlsx files to process both reading and writing.

The files contain about 10 sheets with 1000 rows * 30 columns = up to 300000 cells.

Each of the sheet has some cell style information like background color and also some formula like sum and average inside.

My script is going to read the static data (only!), not the formula or styles. All I need, is the raw data for the reader.

The writer script is appending new data lines and does not touch the style or formula. Also static data, only, and no dynamic or styled content.

 

That's why I wonder if the style details and formula are slowing down the script though?

 

Currently I try optimization with the

  • PHPExcel_Settings::CacheStorageMethod and
  • PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(false);

 

Is there something helpful to disregard the style information or something else to increase the speed of the reader and/or writer with XLSx?

 

Thanks for advice and kind regards,

rabby

Coordinator
Oct 14, 2010 at 7:30 AM

Is there something helpful to disregard the style information or something else to increase the speed of the reader and/or writer with XLSx?

 You can disregard reading style information from a workbook.

$objReader = PHPExcel_IOFactory::createReader('Excel5');
echo 'Turning Formatting off for Load<br />';
/**  Advise the Reader that we only want to load cell data, not formatting  **/
$objReader->setReadDataOnly(true);
/**  Load $inputFileName to a PHPExcel Object  **/
$objPHPExcel = $objReader->load($inputFileName);