[Nh-pm] Excel

Ben Boulanger ben at blackavar.com
Thu Nov 21 10:11:00 CST 2002


Here's one example where I used it to translate PoP location information 
from an excel sheet to a cgi (I probably re-used example code, but it's 
been awhile, so don't quote me there):

#!/usr/bin/perl -w
use strict;
use CGI ':standard';
use Spreadsheet::ParseExcel;

my $oexcel = new Spreadsheet::ParseExcel;

print header,
        "<html>",
        "<body bgcolor=white text=#666644 vlink=#666644 link=#666644>\n",
        "<head><title>\n",
        "PoP Information\n",
        "</title></head>\n";

#Begin Excel transformation
my $obook = $oexcel->Parse('Colo Sites and Tracking/Site Tracker.xls');
my ($irows, $icols, $osheets, $ocells);
$osheets = $obook->{Worksheet}[5];
print h2($osheets->{Name});
print "\n";
print "<table border=1 bgcolor=#DDDDDD>";
for ($irows = $osheets->{MinRow} ; defined $osheets->{MaxRow} &&
     $irows <= $osheets->{MaxRow} ; $irows++) {
        print "<tr>";
        for ($icols = $osheets->{MinCol} ; defined $osheets->{MaxCol} &&
             $icols <= $osheets->{MaxCol} ; $icols++) {
                $ocells = $osheets->{Cells}[$irows][$icols];
                print "<td>";
                print $ocells->Value,"\n" if($ocells);
                print "</td>\n";
        }
        print "</tr>\n";
}
print "</table>";
print end_html;

-- 

The Only Consistent Feature Of All Of Your Dissatisfying Relationships Is You. 




More information about the Nh-pm mailing list