Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
printf("( %s , %s ) => %s<br>", $row, $col, $cell -> {Val});
... my $f_to_parse = "accounts.xlsx"; my $excel = Spreadsheet::XLSX->new($f_to_parse) or die "could not rea +d the excel: $@$!"; foreach my $sheet (@{$excel -> {Worksheet}}) { printf("Sheet: %s<br>", $sheet->{Name}); $sheet -> {MaxRow} ||= $sheet -> {MinRow}; # Skip worksheet if it doesn't contain data. next if $sheet -> {MinRow} > $sheet -> {MaxRow}; foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) { $sheet -> {MaxCol} ||= $sheet -> {MinCol}; foreach my $col ($sheet -> {MinCol} .. $sheet -> {MaxCol} +) { my $cell = $sheet -> {Cells} [$row] [$col]; if ($cell) { printf("( %s , %s ) => %s<br>", $row, $col, $cell -> { +Val}); my $name_header = $cell -> {Val} if $cell -> {Val} + =~m/\bName\b$/i; my $address_header = $cell -> {Val} if $cell -> {Val} + =~m/\bAddress\b$/i; #my $name_val = $sheet->{Cells}[$col][0]->{Val}; #my $address_val = $sheet->{Cells}[$row][0]->{Val}; print "\n\n Test Results:::174^^$name_val -> $address_ +val\n"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Spreadsheet::XLSX Values into DB Help!
by runrig (Abbot) on Jul 25, 2012 at 22:58 UTC | |
by Anonymous Monk on Jul 26, 2012 at 15:31 UTC | |
by runrig (Abbot) on Aug 19, 2012 at 05:52 UTC |