On 8/14/07, Lawrence Statton <[EMAIL PROTECTED]> wrote:
> >
> > Can anybody help me how to convert csv file to excel file using Perl
> > or Shell scripts?
>
> I would use Text::CSV_XS to read the CSV file and
> SpreadSheet::WriteExcel to produce the Excel file.
snip

In addition to the fine modules you listed, you can turn* a CSV into a
file MS Excel can read with the following Perl script.

#!/usr/bin/perl

use strict;
use warnings;

use File::Copy;

for my $file (@ARGV) {
    die "$file is not a csv file\n" unless $file =~ /(.+)\.csv$/i;
    copy($file, "$1.xls");
}

* CSV is a native format for Excel, unless you want to add formating
or formulas to the file as you write it there is no point.  If someone
is asking you for an Excel file and will not accept a CSV, just rename
it, 99 times out of 100 they never notice.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to