I have a huge sheet as my input, but I do not have to read all the columns, I need to read the selected columns only as B, H, I and J from 36 columns, and I will be very grateful for the full code, if some code also provided 4-5 lines. at the moment I am using the following code!
$objWorksheet = $objPHPExcel->setActiveSheetIndex('0') ; $i=0;$dum=false;$sum=0; foreach ($objWorksheet->getRowIterator() as $row) { $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); if($dum) { // iterated. foreach ($cellIterator as $cell) { if($i==1||$i==7||$i==8||$i==9) { if($i==1) { $value[$i]=$cell->getValue(); $pieces = explode("_", $value[$i]); $asd=preg_split('#(?=\d)(?<=[az])#i',$pieces[0] ); // $value[$i]=$asd[1]; } if($i==7) { $value[$i]=PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'Ymd H:i:s'); $A=date('Ym-d', strtotime($value[$i])); $value[7]=$A; } if($i==8) { $value[$i]=PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'Ymd H:i:s'); ; $num2=$value[$i]; } if($i==9) { $value[$i]=$cell->getValue(); } echo $value[$i]; echo "|||||||"; }$i++; }$i=0; echo "<br>";
source share