Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

In reply to Spreadsheet::WriteExcel by BigGuy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2022-10-01 01:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (126 votes). Check out past polls.

    Notices?