Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Adding a new row in excel file

by Anonymous Monk
on Aug 17, 2009 at 20:02 UTC ( #789264=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:


I have been using Spreadsheet::ParseExcel and Spreadsheet::WriteExcel to read and write excel workbooks, respectively.

Spreadsheet::WriteExcel can only be used for creating new excel spreadsheets. I am looking for a module that would/should help me in appending to existing excel files. Adding new rows to the existing worksheets of an excel file is one such typical requirement of mine.

I tried searching in and came across Spreadsheet::ParseExcel::SaveParser which is supposed to be an integration of ParseExcel and WriteExcel. But this does not help me either.

Could someone help me out here?

Replies are listed 'Best First'.
Re: Adding a new row in excel file
by ramrod (Curate) on Aug 17, 2009 at 20:18 UTC
    Try Spreadsheet::SimpleExcel
    I found it has both add_row (per documentation)
    # append data to 'NAME' $excel->add_row('NAME',[qw/new row/]);
    and add_row_at (per documentation)
    # add a row into the middle $excel->add_row_at('Name of Worksheet',1,[qw/new row/]);
Re: Adding a new row in excel file
by Bloodnok (Vicar) on Aug 17, 2009 at 20:19 UTC
    You could use the tried and tested Win32::OLE library - I have to admit to previously not having an awful lot of luck with the libraries you mention and resorted to said library [Win32::OLE] with a fair degree of success.

    A user level that continues to overstate my experience :-))
Re: Adding a new row in excel file
by jrsimmon (Hermit) on Aug 17, 2009 at 20:38 UTC
    Use Win32::OLE. It's much more flexible than the other modules that I've looked at. It may take you a bit longer to implement whatever you're doing with it, but the next time something new comes up you'll be much better prepared to add functionality without having to scrape and replace your current solution.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://789264]
Approved by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2018-05-24 10:48 GMT
Find Nodes?
    Voting Booth?