This is for users who, for whatever reason cannot or don’t want to use the PHPExcel_Cell::stringFromColumnIndex($startColumn) function in phpexcel.. alternative method.
(1) PHPexcel built in function (static object method)
// use echo addressbyrowcol(10,2); would return B10 function addressbyrowcol($row,$col) { return PHPExcel_Cell::stringFromColumnIndex($col).$row; }
(2) Alternative code
Useful functions to quickly convert a cell by row and column number to an absolute excel address:
// use echo addressbyrowcol(10,2); would return B10 function addressbyrowcol($row,$col) { return getColFromNumber($col).$row; } function getColFromNumber($num) { $numeric = ($num - 1) % 26; $letter = chr(65 + $numeric); $num2 = intval(($num - 1) / 26); if ($num2 > 0) { return getColFromNumber($num2) . $letter; } else { return $letter; } }