http://www.perlmonks.org?node_id=670900


in reply to Appending data into an Excel Sheet

As your question is rather vague, I just can guess what your platform is. I am successfully updating an Excel-Shit under Windows, I went directly through OLE hell and used Win32::OLE, Win32::OLE::Const 'Microsoft Excel', and the like. You can record your changes as a macro and translate the calls to Perl. I use something like:
my $Excel = Win32::OLE->GetActiveObject('Excel.Application'); unless ($Excel) { $Excel = Win32::OLE->new('Excel.Application'); } my $xls = $Excel->Workbooks->Open(...); my $sheet = $xls->Worksheets(1);
Open the Excel Macro editor and open help, that gives you all the methods. You will go through hell with all those parameters, undebuggable objects and all those esoteric VBA paranormalia. One last hint, use something like this to find the last used row to append things:
my $lastrow = $sheet->UsedRange->Find( { What => "*", SearchDirection => xlPrevious, SearchOrder => xlByRows } )->{Row};

And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)