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

My file is .xlsx formated. Is it not supported by Spreadsheet::ParseExcel. What i have to do now ???
  • Comment on Re^4: Searching a string in excel sheets

Replies are listed 'Best First'.
Re^5: Searching a string in excel sheets
by pme (Monsignor) on Aug 10, 2015 at 10:41 UTC
Re^5: Searching a string in excel sheets
by Corion (Patriarch) on Aug 10, 2015 at 10:38 UTC

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

Re^5: Searching a string in excel sheets
by poj (Abbot) on Aug 10, 2015 at 19:21 UTC

    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