Rename Datastage jobs through perl

Please provide me Perl script
which reads the data from xcel sheet and renames the dsx file.
Process followed to rename is:
make a list of old and new file names in xcel sheet.
compare the old file name in the xcel sheet with dsx name.
If both are equal then assign the new name to the dsx which is mentioned in the xcel sheet.
Kindly please help me in this.
Expecting a reply soon..

Questions by s4sweety

Showing Answers 1 - 1 of 1 Answers


  • Sep 30th, 2009

use Win32::OLE;
use Win32::OLE::Enum;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Variant;
use Spreadsheet::ParseExcel;
use Spreadsheet::WriteExcel;
use Spreadsheet::ParseExcel::SaveParser;
use strict;

$Win32::OLE::Warn = 3;        
my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');  
my $Book = $Excel->Workbooks->Open("D:/Ganesh/General/one.xlsx");    
my $Sheet = $Book->Worksheets("Sheet1");

my $LastRow = $Sheet->UsedRange->Find({What=>"*",SearchDirection=>xlPrevious,SearchOrder=>xlByRows})->{Row};
my $LastCol = $Sheet->UsedRange->Find({What=>"*",SearchDirection=>xlPrevious,SearchOrder=>xlByColumns})->{Column};

print "nLAST ROW :: $LastRow";
print "nLAST COLOMN :: $LastCol";

my $data="four";
print "nBEFORE DATA :: $data";

for(my $i=2;$i<=$LastRow;$i++)
    my $value=$Sheet->Cells($i,1)->{'Value'};    
    print "nVALUE :: $value";
    if($data eq $value)

print "nNEW DATA :: $data";

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions