Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

copy .csv to .XLSX

by perl101 (Initiate)
on Nov 30, 2012 at 03:11 UTC ( #1006395=perlquestion: print w/ replies, xml ) Need Help??
perl101 has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl use strict; use warnings; use diagnostics; use Excel::Writer::XLSX; <p> Direct copy of example for use of module "Text::CSV_XS" <p> my $csv = Text::CSV_XS->new ({ binary => 1 }); open my $fh, "<", "a.csv" or die "a.csv: $!"; while (my $row = $csv->getline ($fh)) { # do something with @$row

added next 4 lines to "do something with @$row"

open my $fh_xlsx, ">", "write_to.XLSX" or die "write_to.XLSX: $!"; $fh_xlsx=1; chomp $row; print "@$row\n"; } $csv->eof or $csv->error_diag; close $fh or die "a.csv: $!"; close $fh_xlsx or die "write_to.XLSX: $!";

Comment on copy .csv to .XLSX
Select or Download Code
Re: copy .csv to .XLSX
by Anonymous Monk on Nov 30, 2012 at 03:19 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1006395]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2015-07-02 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (37 votes), past polls