user3477108
user3477108

Reputation: 907

perl Spreadsheet::WriteExcel how to write formula on merged cells

Experts, How can I write formula on merged field? The documentation talks about writing on a single cell. I have also gone through the store formula and repeat formula. However, I am not able to figure out what I need. My formula is simple ; just adding a bunch of columns.

I have cells D31:D33 merged and I want to write formula "=SUM(D15:D30)" in it. How can I do it?. Any help would be greatly appreciated. $worksheet->merge_cells('D31:D33'); $worksheet->write_formula('D31', '=SUM(D15:D30)', $hformat3); The code above just puts the sum on cell D31 only. I want this to spread on the whole merged field.

The second question that I have is, how can I remove unused rows?

Thank you very much.

Upvotes: 0

Views: 731

Answers (1)

Robert
Robert

Reputation: 8618

perldoc Spreadsheet::WriteExcel says $worksheet->write('A4', '=SIN(PI()/4)');

This example (copied almost verbatim from the documentation) works for me:

use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new('perl.xls');
$worksheet   = $workbook->add_worksheet();
$worksheet->write('A1', '1');
$worksheet->write('A2', '1');
$worksheet->write('A3', '=SUM(A1:A2)');

A quick web search doesn't turn up anything on using Spreadsheet::WriteExcel for removing rows. You'll probably find some other Perl modules to do that, like Win32::OLE mentiond in http://www.perlmonks.org/?node_id=952167

Upvotes: 1

Related Questions