René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback

Excel and PERL

Note: I have started to move some scripts and source code from this website to GitHub.

This affects some or all of the scripts found on this page. They should be found

I don't intend to maintain the scripts and or sources on this page any longer (so they might be outdated). But I will try to improve the code in the GitHub repository and accept Push Requests.

use warnings;
use strict;

use OLE;

my $excel = CreateObject OLE 'Excel.Application' or die $!;
$excel->{'Visible'} = 1;

my $workbook = $excel -> Workbooks -> Add;

$workbook -> ActiveSheet -> Range('A1')->{'Value'} = "Hello";

$workbook -> ActiveSheet -> Range('C2:D3')->{'Value'} = [ 
  ['one',   'two' ],
  ['three', 'four'],

$workbook -> SaveAs ('C:\\perl.xls') or die $!;

$excel -> Quit;

The excel object model


Spreadsheet::WriteExcel: Write formatted text and numbers to a cross-platform Excel binary file.