my $Excel = Win32::OLE->GetActiveObject('Excel.Application') |
+|
Win32::OLE->new('Excel.Application');
$Excel->{'Visible'} = 0; #0 is hidden, 1 is visible
$Excel->{DisplayAlerts}=0; #0 is hide alerts
# Open File and Worksheet
util->logit("[$PARENT_PROC_NAME]: in_file[$in_file]");
my $Book = $Excel->Workbooks->Open($in_file); # open Excel file
my $sheetcount = $Book->Worksheets->Count;
#util->logit("[$PARENT_PROC_NAME]: sheetcount[$sheetcount]");
foreach my $i (1 .. $sheetcount) {
#util->logit("[$PARENT_PROC_NAME]: i value [$i]");
my $Sheet = $Book->Worksheets($i);
if(defined($Sheet)) {
util->logit("[$PARENT_PROC_NAME]: Sheet[$Sheet]");
my $LastRow = $Sheet->UsedRange->Row + $Sheet->UsedRange->
+Rows->Count - 1;
util->logit("[$PARENT_PROC_NAME]: LastRow[$LastRow]");
$Sheet->Cells($LastRow+1,1)->{Value} = localtime;
}
}
#$Book->SaveAs(Filename =>$in_file);
#my $file_ointer = $Book->Save();
#$Book->SaveAs();
$Book->SaveAs();
$Book->Close();
$Book->Quit();
undef $Book;
I need to save the changes without any manual efforts...
Kindly suggest something.
Thanks in advance.
|