Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Exporting Data to and Excel file format

by mifflin (Curate)
on Jun 09, 2005 at 20:27 UTC ( [id://465303]=note: print w/replies, xml ) Need Help??


in reply to Exporting Data to and Excel file format

use Spreadsheet::WriteExcel; $workbook = Spreadsheet::WriteExcel->new('sample.xls'); $worksheet = $workbook->add_worksheet('ws name'); $worksheet->write(0,0,'something in a1'); $workbook->close();
Update: here's something more specific. It will read a csv file and write it to an Excel file.
use IO::File; use Spreadsheet::WriteExcel; my $infile = IO::File->new("<infile.csv"); my $workbook = Spreadsheet::WriteExcel->new('output.xls'); my$worksheet = $workbook->add_worksheet('ws name'); my $row = 0; while (my $line = $infile->getline()) { chomp($line); my $record = [split ',', $line]; $worksheet->write_row($row,0, $record); $row++; } $infile->close(); $workbook->close();

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-25 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found