Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 89246

How to use cygwin perl v5.8.7 to support Spreadsheet/WriteExcel.pm

$
0
0

I create a test.pl file script code :

#!/usr/bin/perl -

use strict;
use Spreadsheet::WriteExcel;

open (TABFILE, 'a.txt') or die "a.txt: $!";

my $workbook  = Spreadsheet::WriteExcel->new('tab.xlsx');
my $worksheet = $workbook->add_worksheet();

# Row and column are zero indexed
my $row = 0;

while (<TABFILE>) {
    chomp;
    # Split on single tab
    my @Fld = split(',', $_);

    my $col = 0;
    foreach my $token (@Fld) {
        $worksheet->write($row, $col, $token);
        $col++;
    }
    $row++;
}
error message : 
Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin /usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin /usr/lib/perl5/vendor_perl/5.8 .)

and the .txt file like this : two lines like following:

2019/12/27,SHDXIALI2,2020 R2 (build 20191213), ModelDiff_Basic.etp, 2,5,Passed 2019/12/27,SHDXIALI2,2020 R2 (build 20191213), ModelDiff_Basic.etp, 2,5,Passed

I want to save the two lines in the .xlsx file like this : enter image description here


Viewing all articles
Browse latest Browse all 89246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>