Spreedsheet_Excel_Reader to PHPExcel

Topics: Developer Forum, User Forum
Aug 21, 2009 at 10:34 AM

Hi Guys,

i have a small problem like you see in the Code i have one thing left from Spreedsheet_Excel_Reader (Pear) ( "$this->sheets[0]['cells'][$row]" ) but i don't know how i can access this in  PHPExcel

Can someone please help me?

thanks Max

                $objReader = PHPExcel_IOFactory::createReader('Excel2007');

		 $objPHPExcel = $objReader->load("test.xlsx"))			
	        $objWorksheet = $objPHPExcel->getActiveSheet();

		$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
		$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'

		$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
    		for ($row = 1; $row <= $highestRow; ++$row) {

                     //.... some code

                     $objWorksheet->setCellValueByColumnAndRow($spaltenno, $row, $this->import_check_modify_fpointer->$fufuname($objWorksheet->getCellByColumnAndRow($spaltenno, $row)->getValue(),$this->sheets[0]['cells'][$row]));

                     //... some code

                     for ($col = 0; $col <= $highestColumnIndex; ++$col) {
                          $this->import_erg_arr[$i_erg][$ansp] = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();




Aug 21, 2009 at 10:51 AM
Edited Aug 21, 2009 at 10:55 AM

Can you take a look at this method in PHPExcel

$cells = $objWorksheet->toArray();

This is close to what corresponds to

$cells = $this->sheets[0]['cells'];

in PEAR::Spreedsheet_Excel_Reader (SourceForge PHP-ExcelReader)

Note: There are some differences depending whether there are formulas in the sheet you are reading.

Aug 21, 2009 at 11:36 AM

thank you koyama for this fast and very helpfull answer.


Bu now i have the problem that i have an excel with  3 row':

String     Float      Date

aaa        17.76      31.07.2009


And when i var_dump the array i get these values:

aaa         17.76      40025


How can i get the the real Date in the same Format?


best regards max



Aug 21, 2009 at 1:53 PM

Excel holds dates as a floating point timestamp, the number of days since basedate (where basedate is 1/1/1900 for the Windows 1900 calendar).

A number of functions are built into PHP to allow for conversion of dates between Excel format and PHP format, and these can be found in Shared/Date.php. Once a date has been converted to a PHP date using a call to PHPExcel_Shared_Date::ExcelToPHP(), you can use the standard PHP date() function to format it as you wish.


Aug 21, 2009 at 2:20 PM

thanks you are the best.


Great support!


You can close this discussion.


Problem solved :-)