poj#!perl use strict; use Excel::Writer::XLSX; # Create a new Excel workbook and worksheet my $workbook = Excel::Writer::XLSX->new( 'fruits.xlsx' ); my $worksheet = $workbook->add_worksheet(); # get fruit types open FRUITS,'fruit_types.txt' or die "$!"; my @fruits = split '\s',<FRUITS>; # write column for each fruit for my $col (0..$#fruits){ my $fruit = $fruits[$col]; my $filename = $fruit.'.txt'; open IN, $filename or die "Could not open $filename : $!"; my @col = ($fruit); while (<IN>){ chomp; push @col, $_; } print "Writing column $col @col\n"; $worksheet->write_col(0,$col,\@col); } $workbook->close() or die "Error closing file: $!";
In reply to Re^4: Using variable files to add data into excel spreadsheet
by poj
in thread Using variable files to add data into excel spreadsheet
by rickyboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |