getcell variable row and column

Topics: Developer Forum
Aug 22, 2011 at 10:42 PM

I'm trying to make a variable for both column and row for the getcell. Row is easy since its just a simple number $j is the current row


Which works just fine, but when I also try to make the column a variable, it stops working


(btw $letter = 'K' currently, and its my understanding that doing $letter++ will make that an L, is that correct?)

Aug 22, 2011 at 11:13 PM

right + + adds 1 to the letter

for ($a="K"; $a=="Z";$a++){
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($a.1, 'TITLE');

Aug 23, 2011 at 3:18 AM
Edited Aug 23, 2011 at 8:52 AM

Does anyone know why the second code doesn't work?



EDIT: If it helps here is the error message


Fatal error: Uncaught exception 'Exception' with message 'Invalid cell coordinate.' in /home1/flashdr1/public_html/ Stack trace: #0 /home1/flashdr1/public_html/ PHPExcel_Cell::coordinateFromString('14') #1 /home1/flashdr1/public_html/ PHPExcel_Worksheet->getCell('14') #2 {main} thrown in /home1/flashdr1/public_html/ on line 490


Line 94 is this

$size_str .= '<td>'.number_format($objPHPExcel->getActiveSheet()->getCell($letter.$j)->getCalculatedValue(),2).'</td>';