|< 1 2 3 4 ... 10 >| | 93 Einträge, 10 Seiten |
use Win32::OLE;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#!/usr/bin/perl use Win32::OLE; use warnings; use strict; my @data; my $file = 'lala.csv'; my $columns = 5; my $csv_file = 'zieldatei.csv'; my $excel = Win32::OLE->new(); $excel->add_worksheet('Hoffnung'); open(my $fh,'<',$file) or die $!; while(my $line = <$fh>) { chomp $line; my @array = (split(/[\t\s\\]/,$line))[0..($columns1)]; foreach (@array) { s/^\s+/;/g; s/\s+$/;/g; } # foreach push(@data,[@array]); } # while close ($fh); my $format = ''; for my $i(0..scalar(@{$data[0]})-1){ my $max = find_longest(map{$_->[$i]}@data); $format .= '%-'.$max.'s '; } for my $entry(@data){ print sprintf($format . "<< ",@$entry); $excel->add_row('Hoffnung',$entry); } { return $excel->output_to_file($csv_file); return $longest; } my $file2 = 'hoffnung_30_08_2006.csv'; open($fh,'<',$file); open(my $dod,'<',$file2) or die "geht nicht!"; open($dod,'>',$file2); while(<$fh>) { print $dod @data; sub find_longest{ my $longest = 0; for(@_){ my $length = length($_); $longest = $length if($length > $longest); } close ($dod); close ($fh);
Execution of excel.pl aborted due to compilation errors
$ex = Win32::OLE->new('Excel.Application') or die $!;
|< 1 2 3 4 ... 10 >| | 93 Einträge, 10 Seiten |