in reply to Re^2: Problem using SaveAs when trying to change Excel format
in thread Problem using SaveAs when trying to change Excel format
Hi, I' new to perl. I'm appending a row in the excel file. But a pop comes out(to save the temp file) while saving a file. Below is the code I'm using to do the same.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem using SaveAs when trying to change Excel format
by Anonymous Monk on Jul 09, 2014 at 06:54 UTC | |
by Anonymous Monk on Jul 09, 2014 at 11:43 UTC | |
by Anonymous Monk on Jul 09, 2014 at 11:47 UTC | |
by Ratazong (Monsignor) on Jul 09, 2014 at 12:54 UTC | |
by Anonymous Monk on Jul 09, 2014 at 13:07 UTC | |
|