dolo21taf has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I wanted to put in 3 commands to manipulate an excel file using Perl. The first piece of code would say that if the date is not in the format MM/DD/YY, then make it so that it is in this format. The second piece makes sure that the last column with information in it (For example if the last column name was Explanation) doesn’t contain any special characters, and is not NULL. The last piece would say that none of the columns contain nulls except for the date column. I really appreciate your help and your site. Please help....

Replies are listed 'Best First'.
Re: Excel manipulation using Perl
by marto (Cardinal) on Feb 20, 2008 at 09:33 UTC
Re: Excel manipulation using Perl
by peterdragon (Beadle) on Feb 20, 2008 at 14:56 UTC
    You can use OLE as mentioned. Also you can consider using Spreadsheet::ParseExcel to read the spreadsheet in and and Spreadsheet::WriteExcel to write an amended spreadsheet out.

    E.g. code like this

    my $file = "infile.xls"; my $excel = Spreadsheet::ParseExcel::Workbook->Parse($file) || die "cannot parse $file: $!"; my $sheet = $excel->{Worksheet}->[0]; my $sheetname = $sheet->{Name}; my $val1 = $sheet->{Cells}[0][2]->{Val}; my $workbook = Spreadsheet::WriteExcel->new("outfile.xls"); my $worksheet = $workbook->add_worksheet(); my $rowno = 1; my $colno = 0; $worksheet->write($rowno, $colno, 'some value'); my $dateformat = $workbook->add_format(); $dateformat->set_num_format('0000'); $worksheet->write(2,0,'02'); $workbook->close;
    Regards, Peter
      Thanks guys, I will see how effective this is and thanks for welcoming me Perl Monks.