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

Hello folks, I have one work sheet containing the following file error 111.cxx 545 222.cxx 333 333.cxx 545 888.cxx 333 777.cxx 222 in the next spread sheet and using SpreadSheet::WriteExcel to have a formula which will list the # of error occurence in one file for example my next sheet should look like this 545 333 222 111.cxx 1 222.cxx 1 . . . so I was trying to find away to use the formula function under SpreadSheet module somthing like $worksheet2->write(4,4, `=#########`), any idea of an easy way to do it .. Thanks

Replies are listed 'Best First'.
Re: excel formula
by RMGir (Prior) on Jun 21, 2002 at 16:53 UTC
    Sure, like this:
    $worksheet2->write(4,4,'=work1name!B1:B4');
    Here's a sample that works:
    #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; # don't need this here, but might in real script to get cell addresses use Spreadsheet::WriteExcel::Utility; my $workbook=Spreadsheet::WriteExcel->new("test-counts.xls"); my $files_worksheet=$workbook->addworksheet("Files"); $files_worksheet->write(0,0,"111.cxx"); $files_worksheet->write(0,1,"545"); $files_worksheet->write(1,0,"222.cxx"); $files_worksheet->write(1,1,"333"); my $summ_worksheet=$workbook->addworksheet("Summary"); $summ_worksheet->write(0,0,"Sum:"); $summ_worksheet->write(0,1,"=SUM(Files!B1:B2)");
    Specify the name of your first worksheet, as you'll need it to refer to the cells from the second sheet. I'm not sure what the default sheet name would be if you don't specify it... (Sheet1?)
    --
    Mike
      Thanks :)