PHPExcel how to get column index from cell

john Griffiths picture john Griffiths · Aug 11, 2010 · Viewed 56.3k times · Source

PHPExcel $cell->getColumn() returns 'A', 'B', 'C', ...

which is the best way to get the integer (0, 1, 2, ...) from the cell.

This function doesn't exist.

$colIndex = $cell->getColumnIndex();

So what is the alternative withoput converting chr to ascii ?

Answer

Mark Baker picture Mark Baker · Aug 11, 2010
$colIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());