Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use CGI qw( -oldstyle_urls :standard ); use CGI::Carp qw ( fatalsToBrowser ); use Spreadsheet::ParseExcel; print header(); my $header_account; my $header_name; my $got_number; my $got_name; my $f_to_parse="accounts.xls"; my $workbook = Spreadsheet::ParseExcel::Workbook->Parse($f_to_parse)or + die "Unable to open $f_to_parse\n"; foreach my $page (@{$workbook->{Worksheet}}) { if ((defined $page->{MinCol}) && (defined $page->{MaxCol})) { foreach my $col ($page->{MinCol} .. $page->{MaxCol}) { if ($page->{Cells}[0][$col]->{Val} eq 'Account Numbers +') { $header_account = $col; } if ($page->{Cells}[0][$col]->{Val} eq 'Account Names') { $header_name = $col; } } } if ((defined $page->{MinRow}) && (defined $page->{MaxRow})) { foreach my $row ($page->{MinRow}+1 .. $page->{MaxRow}) { $got_number = $page->{Cells}[$row][$header_account]->{Val} +; $got_name = $page->{Cells}[$row][$header_name]->{Val}; } } } # here I will insert the values from the xls file into the database if + they are true. print "got_number=$got_number\n"; print "got_name=$got_name\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with Spreadsheet::ParseExcel
by toolic (Bishop) on Jan 11, 2011 at 16:54 UTC | |
by Anonymous Monk on Jan 11, 2011 at 18:21 UTC | |
by toolic (Bishop) on Jan 11, 2011 at 19:49 UTC | |
|
Re: Help with Spreadsheet::ParseExcel
by jmcnamara (Monsignor) on Jan 11, 2011 at 21:07 UTC | |
by Anonymous Monk on Jan 12, 2011 at 17:26 UTC | |
by jmcnamara (Monsignor) on Jan 12, 2011 at 17:49 UTC | |
by Anonymous Monk on Jan 12, 2011 at 18:00 UTC | |
|
Re: Help with Spreadsheet::ParseExcel
by jmcnamara (Monsignor) on Jan 11, 2011 at 21:24 UTC | |
|
Re: Help with Spreadsheet::ParseExcel
by cjb (Friar) on Jan 11, 2011 at 16:52 UTC | |
by Anonymous Monk on Jan 11, 2011 at 18:10 UTC |