suvendu4urs has asked for the wisdom of the Perl Monks concerning the following question:
V3.xls column 1contains :\SUM\SUM_cam.c \SUM\SUM_cam.h \SUM\SUM_command.c \SUM\SUM_command.h \SUM\SUM_dab.c \SUM\SUM_dmb.c \SUM\SUM_eventHandler.h \SUM\SUM_eventHandler_dab.c \SUM\SUM_eventHandler_dmb.c \SUM\SUM_fap.c \SUM\SUM_fap.h \SUM\SUM_private.h \SUM\SUM_task_dab.c \SUM\SUM_task_dmb.c \SUM\Makefile \SUM\SUM_cam.c
\SUM\SUM_cam.c@@\main\base2ucm_source\600_int\1 \NEW\NEW_calc.c@@\main\base2ucm_source\600_int\1 \NEW\NEW_FAP.c@@\main\base2ucm_source\600_dev_dmb\1 \SIN\COM\SIN_COMconnection.c@@\main\base2ucm_source\600_int\1 \SIN\COM\COMconnection.sm@@\main\base2ucm_source\600_int\1 \SIN\IN\SIN_INdevice.c@@\main\base2ucm_source\600_int\1 \SUM\SUM_cam.c@@\main\base2ucm_source\600_int\1
Now i am comparing each element of file.xls with V3.xls If the element of each row of file.xls is present in V3.xls then i am updating the corresponding row of second column in file.xls with (*) mark
But after executing the .exe generated from the script there is no ouput. Anyone please guide me where is the problem#!/usr/bin/perl -w use strict; 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'); # open Excel file my $Book = $Excel->Workbooks->Open("u:/file.xls"); my $Book1 = $Excel->Workbooks->Open("u:/v3.xls"); # select worksheet number 1 (you can also select a worksheet by name) my $Sheet = $Book->Worksheets(1); my $Sheet1 = $Book1->Worksheets(1); my $val1; my $cnt=0; my $line; foreach my $row (1..3000) { foreach my $col (1) { my $val; next unless defined $Sheet->Cells($row,1)->{'Value'}; $val = $Sheet->Cells($row,1)->{'Value'}; #findl($val); for($cnt=1;$cnt<=65536;$cnt++){ $val1 = $Sheet1->Cells($cnt,1)->{'Value'}; if ((defined $val1) && (index($val1,$val) != -1)){ $line =$cnt if (!defined $line); $Sheet->Cells($row,2)->{'Value'}= *; last; } } } } $Book->SaveAs ("u:/file.xls") ; # clean up after ourselves $Book->Close; $Book1->Close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WIN32OLE program to compare
by marto (Cardinal) on Aug 19, 2010 at 15:37 UTC | |
by suvendu4urs (Initiate) on Aug 19, 2010 at 16:16 UTC | |
by marto (Cardinal) on Aug 19, 2010 at 18:47 UTC | |
|
Re: WIN32OLE program to compare
by dasgar (Priest) on Aug 19, 2010 at 18:51 UTC |