Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Adding Excel sheet

by Trix606 (Monk)
on Oct 19, 2005 at 03:13 UTC ( #501159=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Adding Excel sheet
in thread Adding Excel sheet

Looking at your original post, I'm a little confused as to why you need to edit a cell. If you use Spreadsheet::ParseExcel::SaveParser you load in your existing spreadsheet then create your new worksheet:

$oBook->AddWorksheet('February');
To this new blank worksheet first add the cells from the prior month's worksheet that are the same in the new month's worksheet for example:
my $oOld_Sheet = $oBook->{Worksheet}[0]; for (my $row = 0; $row <= 4; $row++) { my $oCell = $oOld_Sheet->{Cells}[$row][0]; if (defined $oCell->{Val}) { $oBook->AddCell(1, $row, 0, $oCell->{Val}, $oCell); } }
Adding the sales for the new month to the new sheet using the AddCell method as well. Finally save the workbook under a new name using the SaveAs method.

If you really need to edit a cell then Win32::OLE as InfiniteSilence and davidrw mentioned is probably what you will have to use, also if the worksheet you are adding contains formulas.


Comment on Re^3: Adding Excel sheet
Select or Download Code
Replies are listed 'Best First'.
Re^4: Adding Excel sheet
by Fuism (Beadle) on Oct 19, 2005 at 15:13 UTC
    Yes the worksheets contain formulas. For the new worksheet, I need everything to be the same as the previous(format, etc). I just need to replace most of the numbers copied over from the previous worksheet with the numbers from the current month. I will try Win32::OLE.. Thanks again...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://501159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2015-07-07 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls