a.alandkar has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I am trying to access xls file but its giving me an error. The code is as below.
#!/usr/bin/perl –w use strict; # use Spreadsheet::ParseExcel; use Spreadsheet::XLSX; my $FileName = "C:/Users/Ambar.Alandkar/Desktop/Ambar/Perl-Test/Pe +rl-Test.xls"; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse($FileName); die $parser->error(), ".\n" if ( !defined $workbook ); # Following block is used to Iterate through all worksheets # in the workbook and print the worksheet content for my $worksheet ( $workbook->worksheet(0) ) { print("Test"); # Find out the worksheet ranges 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 ) { # Return the cell object at $row and $col my $cell = $worksheet->get_cell( $row, $col ); next unless $cell; print "Row, Col = ($row, $col)\n"; print "Value = ", $cell->value(), "\n"; } } }
Please help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: No Excel data found in file
by Athanasius (Archbishop) on Aug 22, 2014 at 09:53 UTC | |
by a.alandkar (Novice) on Aug 22, 2014 at 11:13 UTC | |
by roboticus (Chancellor) on Aug 22, 2014 at 12:11 UTC | |
|
Re: No Excel data found in file
by aitap (Curate) on Aug 22, 2014 at 10:01 UTC | |
|
Re: No Excel data found in file
by Tux (Canon) on Aug 22, 2014 at 10:50 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |