in reply to Perl Excel Formulas With Worksheet Links
Yes, there is a sheet named Sales in one of the formulas. From what I have read, this should be possible.use Spreadsheet::ParseExcel; use Spreadsheet::WriteExcel;
foreach my $sheet (keys %$storage_book){ my $dest_sheet = $dest_book->addworksheet($sheet); foreach my $row (keys %{$storage_book->{$sheet}}){ foreach my $col (keys %{$storage_book->{$sheet}->{$row}}){ if ($sheet eq "Sales") { if ($storage_book->{$sheet}->{$row}->{$col} eq 'Agent') { $getsales=1; #next row start getting sales } elsif ($storage_book->{$sheet}->{$row}->{$col} eq 'Total') { $getsales=0; #stop getting sales } #GET THE AGENTS NAME if (($getsales ==1) && ($col == 0)) { #performs a sql query here } } if (($getsales == 1) && ($col == 4) && ($sheet eq "Sales") && ($ +agentname eq "Agent")) { $dest_sheet->write($row, $col, $exchange_rate); } elsif (($getsales == 1) && ($col == 2) && ($sheet eq "Sales")) { if ($agentname eq "Agent") { $dest_sheet->write($row, $col, $storage_book->{$sheet}->{$ro +w}->{$col}); } else { $dest_sheet->write($row, $col, $cdnsales); } } elsif (($getsales == 1) && ($col == 3) && ($sheet eq "Sales")) { if ($agentname eq "Agent") { $dest_sheet->write($row, $col, $storage_book->{$sheet}->{$ro +w}->{$col}); } else { $dest_sheet->write($row, $col, $usdsales); } } else { if (($row == 0) && ($col == 1) && ($sheet eq "Sales")) { $dest_sheet->write($row, $col, $startdate); } elsif (($row == 0) && ($col == 3) && ($sheet eq "Sales")) { $dest_sheet->write($row, $col, $today); } else { ###HERE IS LINE 265 $dest_sheet->write($row, $col, $storage_book->{$sheet}->{$ro +w}->{$col}); } } } # foreach column } # foreach row } # foreach sheet $dest_book->close();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Perl Excel Formulas With Worksheet Links
by jmcnamara (Monsignor) on Feb 13, 2003 at 00:03 UTC | |
by cheryld497 (Initiate) on Feb 13, 2003 at 00:25 UTC |