Question

currently, I used PHPExcel to import excel file, there is a function $cell->getCoordinate();

I would like to ask any solution for split the cell coordinate alphabet and integer?

e.g A1, A2,

I need to know currently which row, and until which column.

I do some research about split, but not luck for it. Any idea?

Was it helpful?

Solution

This:

$coord = 'AF13';
preg_match_all('~[A-Z]+|\d+~', $coord, $split);
print_r($split);

Will produce:

Array (
  [0] => Array (
    [0] => AF
    [1] => 13
  )
)

OTHER TIPS

$coordinate = PHPExcel_Cell::coordinateFromString('A1');
var_dump($coordinate);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top