veeru612 has asked for the wisdom of the Perl Monks concerning the following question:
I wrote another but its not working, am pretty sure it's not the right code/is full of errors.#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new('test.xls'); my $worksheet = $workbook->add_worksheet(); open INPUT, 'data.SSM' or die "Couldn't open file: $!"; $worksheet->write($.-1, 0, [split]) while <INPUT>;
#!/usr/bin/perl -w use strict; use Spreadsheet::ParseExcel; use Spreadsheet::WriteExcel; my %count; my $directory = "c:\\perl test scripts"; my $workbook = Spreadsheet::WriteExcel->new('test.xls'); my $worksheet = $workbook->add_worksheet(); opendir(DIR, $directory ) || die "Unable to open directory - $!\n"; my @files = grep /\.txt/, readdir( DIR ); closedir( DIR ); foreach my $file (@files) { open( FH, "$directory\\$file" ) || die "Unable to open $file - $!\n"; while( <FH> ) { $worksheet->write($.-1, 0, [split]) while <FH>; } close( FH ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: export data from multiple files in a folder to an excel file
by space_monk (Chaplain) on Nov 29, 2012 at 17:42 UTC | |
|
Re: export data from multiple files in a folder to an excel file
by Anonymous Monk on Nov 29, 2012 at 18:43 UTC | |
by veeru612 (Initiate) on Nov 29, 2012 at 19:03 UTC | |
by Anonymous Monk on Nov 29, 2012 at 19:30 UTC | |
by veeru612 (Initiate) on Nov 30, 2012 at 12:58 UTC | |
|
Re: export data from multiple files in a folder to an excel file
by rpnoble419 (Pilgrim) on Nov 30, 2012 at 22:18 UTC |