Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Spreadsheet::WriteExcel

by BigGuy (Friar)
on Nov 04, 2000 at 01:03 UTC ( [id://39908]=modulereview: print w/replies, xml ) Need Help??

Item Description: To write a spreadsheet in native excel binary form

Review Synopsis: Very Useful module for me anyway :-)

To use this module
use Spreadsheet::WriteExcel;

As stated above this module allows you to write excel files
without that annoying popup asking you how your file is
delimeted when you open the file. It works very well,
the only problem i had was trying to convert one of our flat files
that is over 70,000 records in length. But after
i checked the problem is documented, it can only produce files
<~ 7.0 MB. heres on little program I have created with it

#!/usr/bin/perl use Spreadsheet::WriteExcel; print "Enter the path to the file(ie /home/): "; $path = <>; chomp($path); print "Enter the filename(ie data): "; $fname = <>; chomp($fname); $file = "$path$fname"; my $workbook = Spreadsheet::WriteExcel->new("/tmp/$fname.xls"); $worksheet1 = $workbook->addworksheet(sheet1); $worksheet2 = $workbook->addworksheet(sheet2); $worksheet3 = $workbook->addworksheet(sheet3); $format = $workbook->addformat(); $format->set_bold(); $format->set_color('black'); $format->set_align('center'); $format->set_size('10'); open input, "$file" || die "Can't open that file"; $k=0; for (<input>){ chomp($_); @data = split(/\t/,$_); for ($i=0; $i<=@data; $i++){ $worksheet1->write($k, $i, $data[$i], $format); } $k++; }
Good Luck
Rob

Replies are listed 'Best First'.
RE: Spreadsheet::WriteExcel
by nop (Hermit) on Nov 06, 2000 at 05:44 UTC
    I agree -- a great module, great docs. Even better now that it supports cell formatting.
    Minor minor minor gripe: the format objects appear bound to a specific sheet... that is, if you have multiple sheets open for writing, you cannot simply define one set of formats (eg fmt_important = bold and red, fmt_header = bold and underlined, etc) and apply them across the board to all open sheets. At least I couldn't get this to work... maybe I missed something.
    Overall, a fantastic piece of code.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: modulereview [id://39908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found