programming-examples/perl/Win32/Assign value to data sheet in Excel.pl

16 lines
400 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use Win32::OLE;
$operand1 = '2';
$operand2 = '2';
$excelobject = Win32::OLE->new('Excel.Sheet');
$excelobject->Cells(1,1)->{Value} = $operand1;
$excelobject->Cells(2,1)->{Value} = $operand2;
$excelobject->Cells(3,1)->{Formula} = '=R1C1 + R2C1';
$sum = $excelobject->Cells(3,1)->{Value};
$excelobject->Quit();
print "According to Microsoft Excel, $operand1 + $operand2 = $sum.\n";