unable to read excel file in perl by Spreadsheet::Parseexcel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanyogitak
    New Member
    • Jan 2016
    • 1

    unable to read excel file in perl by Spreadsheet::Parseexcel

    Code:
    use strict;
    use warnings;
    use Spreadsheet::ParseExcel;
     
    my $parser   = Spreadsheet::ParseExcel->new();
    my $workbook = $parser->parse('D:\perl_try\Report.xls');
     
    if ( !defined $workbook ) {
        die $parser->error(), ".\n";
    }
     
    for my $worksheet ( $workbook->worksheets() ) {
     
        my ( $row_min, $row_max ) = $worksheet->row_range();
        my ( $col_min, $col_max ) = $worksheet->col_range();
     
        for my $row ( $row_min .. $row_max ) {
            for my $col ( $col_min .. $col_max ) {
     
                my $cell = $worksheet->get_cell( $row, $col );
                next unless $cell;
     
                print "Row, Col    = ($row, $col)\n";
                print "Value       = ", $cell->value(),       "\n";
                print "Unformatted = ", $cell->unformatted(), "\n";
                print "\n";
            }
        }
    }

    I get file not found exception for this script.
    path mentioned is correct one .
    please help
    Last edited by Rabbit; Jan 17 '16, 10:40 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...