#!c:/perl/bin/perl -w use strict; use warnings; use Win32::OLE; use File::Find; # Start Excel and make it visible my $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 1; # Create a new workbook my $xlBook = $xlApp->Workbooks->Add; open FILE, "; #print "@report\n"; #print "$report[2]\n"; my $counter = 0; my $column = "A"; my $row = 1; my $dir = "D:/Documents and Settings/m0F61468/Desktop/New Folder"; find(\&textify, $dir); sub textify() { my $file = $_; print "File name is $_\n\t\tFull path is $File::Find::name\n"; } my @fourthings = (); foreach (@report) { if (/^Spare part/) { $fourthings[2] = substr("$report[$counter]",12,-1); } elsif (/^Value of this amendment/) { $fourthings[3] = substr("$report[$counter]",25,-5); } elsif (/^Lurgi GmbH, Lurgiallee 5, D-60439 Frankfurt am Main/) { $fourthings[1] = substr("$report[$counter+2]",0,-1); } elsif (/^PO reference/) { $fourthings[0] = substr("$report[$counter+1]",0,10); } $counter += 1; } #print "@fourthings\n"; #print "$fourthings[0]\n"; #print "$fourthings[1]\n"; #print "$fourthings[2]\n"; #print "$fourthings[3]\n"; my $four = [$fourthings[0], $fourthings[1], $fourthings[2], $fourthings[3]]; print "$four\n"; # Write all the data at once... my $rng = $xlBook->ActiveSheet->Range("A1:D1"); $rng->{Value} = $four;