!/usr/bin/perl -w

use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel'; 

$Win32::OLE::Warn = 3; # die on errors...

# get already active Excel application or open new
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit'); 

# get a new workbook
$book = $ex->Workbooks->Open('C:\Users\Andrew Babitt\Documents\ProductClonesTest.xls');
$Obook = $ex->Workbooks->Open('C:\Users\Andrew Babitt\Documents\NSS\extract_Products.xls');

my $billschedule = $Obook->clumn(B)->{value};
my $totalamount = $book->clumn(D)->{value};
my $opnum = $book->clumn(E)->{value};

my @array = (\$billschedule, \$totalamount, \$opnum);

my $var = 0;

while ($book->Range(0,0)->{value} ne '')
if (@array[0][$var] = $book->Range(0,9)->{value})
    if (@array[1][$var] = $book->Range(0,10)->{value})
        write(@array[2][$var], $book->Range(0,11)->{value});
$var = $var+1;

6 Years
Discussion Span
Last Post by wickedxter

Trying to create a perl script to take in data from on Excel file($Obook), store it into an array. then compare portions of that array to columns in the second book($book).

and it would be compared to columns in the other excel file that will contain the same data. It will make sure the first value(array[0][n]) is equal to a value in the column, if it is, need to make sure the second value(array[1][n]) is the same and if both of those match. Then write out 3rd value(array[2][n]) to the last column on $book.

Some guidance would be great.
thanks for your help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.