in reply to Re^2: Searching a string in excel sheets
in thread Searching a string in excel sheets

That error code means that the file you passed to your program was not in a format understood by Spreadsheet::ParseExcel. Maybe your file is not an .xls file?

Replies are listed 'Best First'.
Re^4: Searching a string in excel sheets
by ravi45722 (Pilgrim) on Aug 10, 2015 at 10:36 UTC
    My file is .xlsx formated. Is it not supported by Spreadsheet::ParseExcel. What i have to do now ???

      Find a module that reads XLSX files. A CPAN search could point you to the correct module to use.

      Date formats can be a problem with Excel, you might need to convert to match properly

      #!perl use strict; use Spreadsheet::XLSX; use Spreadsheet::ParseExcel::Utility qw(ExcelFmt); my $col1 = 1; # B my $col2 = 35; # AJ my $wb = Spreadsheet::XLSX->new ('c://temp//Book1.xlsx'); my $ws = $wb->Worksheet('Sheet1'); foreach my $row ($ws->{MinRow} .. $ws->{MaxRow}) { # column B my $c1 = $ws->get_cell($row,$col1); my $ymd = ExcelFmt('yyyy-mm-dd', $c1->unformatted) if defined $c1;; # column AJ my $c2 = $ws->get_cell($row,$col2); my $value = $c2->value if defined $c2; print "$row $ymd $value\n"; }
      poj