Hi guys, I am working on converting a txt file to xls file from past one week and now that when I have finished with coding, I am getting some execution problem, I am sure this is something about library path problem. On posting this in some forum I got the replies as
"Spreadsheet::WriteExcel must be available in perl lib, before running this OR you can set your PERL5LIB environment variable to point to your local lib where you have Spreadsheet::WriteExcel "
But i have no idea how to do this.
While executing the script I am getting the error as
Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /bin/txt2xls line 4.
BEGIN failed--compilation aborted at /bin/txt2xls line 4.
My code is
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
if($#ARGV ne 1)
{
print "\n Usage: txt2xls \n Example: txt2xls \"|\" *.psv\n\n";
}
my $token;
my $file;
my $del;
my $wb;
my @files = @ARGV[1..$#ARGV];
foreach $file (@files){
open (TXTFILE, "$file") or die;
my $wb = Spreadsheet::WriteExcel->new("$file.xls");
my $excel = $wb->addworksheet();
my $row = 0;
my $col;
while (<TXTFILE>) {
chomp;
if ($ARGV[0] =~ /\|/)
{
$del="\|";
}
else
{
$del = $ARGV[0];
}
my @Fld = split(/$del/, $_);
$col = 0;
foreach $token (@Fld) {
$excel->write($row, $col, $token);
$col++;
}
$row++;
}
Please help me resolving this.. Thanks in advance
@martinth... : I did whatever you have mentions... but it did not make any difference while executing the script. its still throwing same error.
I have a hint which I got form some other forum : Spreadsheet::WriteExcel must be available in perl lib, before running this OR you can set your PERL5LIB environment variable to point to your local lib where you have Spreadsheet::WriteExcel.
But how to work with this hint ?
"Spreadsheet::WriteExcel must be available in perl lib, before running this OR you can set your PERL5LIB environment variable to point to your local lib where you have Spreadsheet::WriteExcel "
But i have no idea how to do this.
While executing the script I am getting the error as
Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /bin/txt2xls line 4.
BEGIN failed--compilation aborted at /bin/txt2xls line 4.
My code is
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
if($#ARGV ne 1)
{
print "\n Usage: txt2xls \n Example: txt2xls \"|\" *.psv\n\n";
}
my $token;
my $file;
my $del;
my $wb;
my @files = @ARGV[1..$#ARGV];
foreach $file (@files){
open (TXTFILE, "$file") or die;
my $wb = Spreadsheet::WriteExcel->new("$file.xls");
my $excel = $wb->addworksheet();
my $row = 0;
my $col;
while (<TXTFILE>) {
chomp;
if ($ARGV[0] =~ /\|/)
{
$del="\|";
}
else
{
$del = $ARGV[0];
}
my @Fld = split(/$del/, $_);
$col = 0;
foreach $token (@Fld) {
$excel->write($row, $col, $token);
$col++;
}
$row++;
}
Please help me resolving this.. Thanks in advance
@martinth... : I did whatever you have mentions... but it did not make any difference while executing the script. its still throwing same error.
I have a hint which I got form some other forum : Spreadsheet::WriteExcel must be available in perl lib, before running this OR you can set your PERL5LIB environment variable to point to your local lib where you have Spreadsheet::WriteExcel.
But how to work with this hint ?