I am using perl module WriteExcel to convert a | delimited text file into xls file, I am using below code to do so
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
# Create a new workbook and add a worksheet
my $workbook = Spreadsheet::WriteExcel->new($filename);
my $worksheet = $workbook->add_worksheet("Colorful Example");
open(FH,"<$my_path/source_file.txt")
or die "Cannot open file: $!\n";
my ($x,$y) = (0,0);
while (<FH>){
chomp;
my @list = split /\t/,$_;
foreach my $c (@list){
$worksheet->write($x, $y++, $c);
}
$x++; $y=0;
}
close(FH);
$workbook->close(); # Close Workbook
By this code i can convert the file into single tab excel. I am wondering how can i convert the text file into multi tab xls (excel file having multiple worksheets) file when number of rows exceed 65000.