I am using Spreadsheet::WriteExcel to get all files in a directory and
convert them from tab-delimited text to xls format. When I import them
manually, my subsequent formula works fine. However, when I use the same
formula on the converted file, I get a #DIV/0!. I notice that in the last
cell on each line (not used in the formula) contains an "empty box" ASCII
character, so I am wondering, do I have hidden ASCII characters in these
converted files that are interfering with the formula? Or is there another
problem that is causing the problem? How do I get around this?

my @lines =`ls -1 $tc2000`;
print @lines;
foreach $file (@lines) {

    chomp($file);
    print "$file...\n";
    # Open the tab-delimited file
    open (HISTFILE, "$tc2000$file") or die "$tc2000$file: $!";
    $excel = $file;
    $excel =~ s/\.txt/\.xls/;
    # Create a new Excel workbook

    my $workbook  = Spreadsheet::WriteExcel->new("$tc2000$excel");
    my $worksheet = $workbook->addworksheet();
    # Row and column are zero indexed
    my $row = 0;

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

       my $col = 0;
       foreach my $token (@Fld) {
           $worksheet->write($row, $col, $token);
           $col++;
       }
       $row++;
    }




}

close HISTFILE;


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to