http://www.perlmonks.org?node_id=218164


in reply to Using Win32::OLE and Excel - Tips and Tricks

What's the advantage to the method you propose for finding the last column and row as opposed to something more like
# Assuming all variables declared in a "my" statement above. # Also assuming $worksheet is pointing to a WorkSheet object. $last_cell = $worksheet->Range("A1")->EntireColumn-> SpecialCells(xlCellTypeLastCell)->{Address}; ($last_col, $last_row) = $last_cell =~ /\$(\w+)\$(\d+)/;
?

(Note that the last cell returned by this method does not depend on the Range("A1") specified -- it still returns the last cell properly. For example, N23 (as text $N$23) if N23 were the last cell in the sheet.)