Perl interaction with Office apps

Sidewinder
07-10-2002, 05:51 PM
OK, so here I am at the absolute beginning of my (probably brief) Perl programming career.

Perl is in play in my life because I want to feed info from a shared Excel spreadsheet into a webpage.

Not to get ahead of myself (I mean I'm still learning $ vs @ and % etc), but can someone sketch out for me, vaguely, how a Perl program can extract data from programmer-designated cells in the spreadsheet, into, say, a scalar or better yet an array?

Does Perl have this capability? Would it work better with Access than with Excel?

Help.

Too confused and dizzied by what's ahead of me over here.

Derek Stone
07-10-2002, 06:55 PM
If Perl supports COM then its possible to extract data from an Access or Excel file via their associated objects. Otherwise you'll be forced to use SQL to extract the information from a database of your choosing, which in any case, is a better solution.

-CL

Robby
07-10-2002, 07:12 PM
I never tried with Excel, Here's a dust-collecting sample with Access...


# dblist.pl
# lists entries in a database.

print <<EOF
Content-type: text/html

<html>
<head><title>Company DataBase</title></head>
<body>
<center><table border>
<tr>
<th>Part Number</th><th>Description</th><th>Price</th>
</tr>
EOF
;

use Win32::ODBC;
$db = new Win32::ODBC("myDSN");
$db->Sql("SELECT * FROM Items Order by PartNumber");
while ($db->FetchRow()) {
my(%record) = $db->DataHash();
print "<tr><td>$record{'PartNumber'}</td>";
printf "<td>%-23s</td>", $record{Description};
printf "<td>%.2f</td></tr>", $record{Price};
}
$db->Close();
print "</center></table></body></html>";

Sidewinder
07-11-2002, 01:54 PM
Ok, so...ah (ahem) er...(meekly now): What is COM?

Thinker
07-11-2002, 03:28 PM
Component Object Model. All ActiveX components are COM
objects, so access to either Excel or Dataaccess objects means
being able to interact with COM/ActiveX objects. Something that
isn't native in Perl, but Robby's example shows using a library that
seems to know how to do it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum