Spreadsheet::WriteExcelXML - Create an Excel file in XML format.
The Spreadsheet::WriteExcelXML module can be used to create an Excel file in XML format. The Excel XML format is supported in Excel 2002 and 2003.
Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, and formulas can be written to the cells. The module supports strings up to 32,767 characters and the strings can be in UTF8 format.
Spreadsheet::WriteExcelXML uses the same interface as Spreadsheet::WriteExcel.
This module cannot, as yet, be used to write to an existing Excel XML file.
To write a string, a formatted string, a number and a formula to the first worksheet in an Excel XML spreadsheet called perl.xls:
use Spreadsheet::WriteExcelXML;
# Create a new Excel workbook
my $workbook = Spreadsheet::WriteExcelXML->new("perl.xls");
# Add a worksheet
$worksheet = $workbook->add_worksheet();
# Add and define a format
$format = $workbook->add_format(); # Add a format
$format->set_bold();
$format->set_color('red');
$format->set_align('center');
# Write a formatted and unformatted string, row and column notation.
$col = $row = 0;
$worksheet->write($row, $col, "Hi Excel!", $format);
$worksheet->write(1, $col, "Hi Excel!");
# Write a number and a formula using A1 notation
$worksheet->write('A3', 1.2345);
$worksheet->write('A4', '=SIN(PI()/4)');
This module requires Perl 5.005 (or later).
Use the standard Unix style installation, a ppm for Windows users will be available in the next release:
Unzip and untar the module as follows or use winzip:
tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz
The module can be installed using the standard Perl procedure:
perl Makefile.PL
make
make test
make install # You may need to be root
make clean # or make realclean
John McNamara (jmcnamara@cpan.org)