Problem with getHighestColumn () PHPExcel

4

I'm having a problem, I have to do a for and the variable that happens to me is from the library PHPExcel ->getHighestColumn() , but the problem is that it returns "G", "Z", "AA", "AB". And there's the problem, it occurred to me to pass it to ASCII (A is 65, B is 66, etc) but when I want to pass to the value of column AA or AB for example (with the function ord() ) it returns 65 , as if the value were A, and not AA or AB. I hope if anyone has an idea how to do it. Greetings and thanks in advance.

    
asked by Gino Iannuzzi 24.05.2016 в 15:49
source

1 answer

1

To achieve what you want you can use the function columnIndexFromString() offered by PHPExcel. For example:

$colNumber = PHPExcel_Cell::columnIndexFromString($colString);

Where $ colString is the letter of the column, that is: returns 1 with $colString = 'A' , 26 with 'Z', 27 with 'AA', etc.

You can read more info in the following SO question in English:

link

    
answered by 24.05.2016 в 16:05