How to add a new row to an existing Excel spreadsheet using Perl?

I created an Excel a.xls worksheet using Perl, where I have a field:

date name eid 13/jan/2010 asa 3175 

The next time I compile, and if the date is more than the previous date, it should update as wise:

 date name eid 13/jan/2010 asa 3175 14/jan/2010 stone 3180 

If the date will have the date of the previous line, since the date of the last line is 14/jan/2010 , and the current date is also 14/jan/2010 , then it should not insert any line that should update only the previous record.

+4
source share
3 answers

See the example in Table: ParseExcel :: SaveParser Documentation . As I understand it, the AddCell method can replace an existing cell or add a new one.

+5
source

With Excel 2007 files using Excel :: Writer :: XSLX , you cannot do this. Starting with version 0.47 from June 2012:

This module cannot yet be used to write to an existing Excel XLSX file.

You can only create new files.

0
source
  use Win32::OLE::Const 'Microsoft Excel'; $Excel = Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{DisplayAlerts}=0; my $workbookpath = "D:\\temp.xlsx"; my $workbook = $Excel->Workbooks->Open($workbookpath); # lets think if you created multiple sheets in an workbook, you can refer each workbook by name(Ex: sheet1 here) my $sheet = $workbook->WorkSheets("sheet1"); #Insert row in a particular row value $sheet->Cells(8,1)->EntireRow->Insert; #save and close workbook, its a best practise when you are doing any excel operation $workbook->Save; $workbook->Close(); 
0
source

All Articles