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
| #!C:/Perl/bin/perl.exe
use strict;
use Spreadsheet::ParseExcel;
use Spreadsheet::WriteExcel;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
my $excel_in = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
my $book = $excel_in->Workbooks->Open("C:\\Clients\\Systeme_U\\marketing_distinctif\\produits_SU1107.xls");
my $sheet = $book->Worksheets(1);
my $array1 = $sheet->Range("A3:A167" )->{'Value'};
my $array2 = $sheet->Range("B3:B167" )->{'Value'};
my $sheet2 = $book->Worksheet(2);
$book->Close;
foreach my $ref_array1 (@$array1) {
foreach my $ref_array2 (@$array2) {
foreach my $scalar1 (@$ref_array1) {
foreach my $scalar2 (@$ref_array2) {
my $ligne=0;
foreach my $word1 ( split(' ',$scalar1) ) {
foreach my $word2 ( split(' ',$scalar2) ) {
print "$word1;$word2\n";
my $fichier= "C:\\Clients\\Systeme_U\\marketing_distinctif\\produits_SU1107.csv";
open F, ">>$fichier"; # ouverture en ajout dans un fichier existant
print F "$word1;$word2\n"; # écriture de $chaine dans le fichier
}
}
$ligne++;
}
}
}
}
close F;
print "File Completed\n";
system("pause"); |
Partager