Assuming the columns names are in row 1
poj#!perl use strict; use Spreadsheet::ParseExcel; use Data::Dump 'pp'; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('c:/temp/Book1.xls'); my $worksheet = $workbook->worksheet('Sheet1'); my ($row_min, $row_max) = $worksheet->row_range(); my @required_cols = (0,2..5); # columns names my @name=(); # build array of hashes my @details=(); for my $row (0..$row_max){ my $href={}; for my $col (@required_cols){ my $cell = $worksheet->get_cell($row, $col); my $value = $cell ? $cell->value() : ''; if ($row==0){ $name[$col] = $value; } else { $href->{$name[$col]} = $value; } } push @details,$href if ($row); } pp \@details;
In reply to Re: Group cols with row number Spreadsheet::ParseExcel perl
by poj
in thread Group cols with row number Spreadsheet::ParseExcel perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |