a.alandkar has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, Is there any function to get number of rows in a perticular column.?

Replies are listed 'Best First'.
Re: XLS help
by Tux (Canon) on Sep 05, 2014 at 06:54 UTC
    use 5.20.0; use warnings; use Spreadsheet::Read; my $sheet = 1; my $column = 2; my @column = @{ReadData ("file.xls")->[$sheet]{cell}[$column]}; while (@column and !defined $column[-1]) { pop @column; } say "Column ${column}'s last defined row = ", $#column;

    Or if you prefer the reference

    my $colref = ReadData ("file.xls")->[$sheet]{cell}[$column]; pop @$colref while $#$colref > 1 && !defined $colref->[-1]; say "Column ${column}'s last defined row = ", $#$colref;

    If all columns have equal length, you can skip the mumble-jumble and just use

    say "Column ${column}'s last defined row = ", ReadData ("file.xls")->[$sheet]{maxrow};

    Enjoy, Have FUN! H.Merijn
Re: XLS help
by Corion (Patriarch) on Sep 05, 2014 at 06:06 UTC

    What Excel/XLS/XLSX module are you using?

    Most modules have a way to return you a row as an array. Then it's just the matter of finding the number of entries in that array.

      I guess to answer the OPs question one would need a column as an array... ;)

      HI, I am using Spreadsheet::ParseExcel module