Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
1, 23,45, 454,54,45,656,56,565,65,.... 2,343,4545, 5656,56,6767,67,6,767,6,76,767,... 3,454, 56546,4545,6,45,64,5,45,4,5,4,54,54,5,4,...
I would actually want them to either be able to get the values of those columns stored in a variable or able to print to a file in a csv format. Advance thanks for all the suggestions!#!/software/bin/perl BEGIN { unshift @INC, '/nfs/users/nfs_d/dmb/perl/lib' ; unshift @INC, '/nfs/users/nfs_d/dmb/perl/lib2' ; } use strict; #use warnings ; use File::Basename ; use Algorithm::Permute ; use Spreadsheet::ParseExcel; use Getopt::Long; my($excel_file, $outputdir); &GetOptions("if=s" =>\$excel_file, "od=s" =>\$outputdir, ); my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->Parse($excel_file) || die "Cannot parse the fi +le $!\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 ( 1.. $row_max ) { my @required_col = (0,2,13..47); for my $col(@required_col){ my $cell = $worksheet->get_cell($row, $col ); next unless $cell; print ($row, $col),"\n"; print $cell->value(),"\n"; # print "Unformatted = ", $cell->unformatted(), "\n"; print "\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Spreadsheet::ParseExcel assigning the column
by Tux (Canon) on Mar 28, 2011 at 15:55 UTC | |
|
Re: Spreadsheet::ParseExcel assigning the column
by Nikhil Jain (Monk) on Mar 28, 2011 at 16:20 UTC | |
|
Re: Spreadsheet::ParseExcel assigning the column
by Tux (Canon) on Mar 28, 2011 at 16:30 UTC | |
|
Re: Spreadsheet::ParseExcel assigning the column
by wind (Priest) on Mar 28, 2011 at 16:40 UTC | |
by Anonymous Monk on Mar 29, 2011 at 15:13 UTC | |
by wind (Priest) on Mar 29, 2011 at 15:50 UTC |