perl excel - ghdrako/doc_snipets GitHub Wiki
- https://metacpan.org/pod/Excel::Writer::XLSX
- https://metacpan.org/pod/Excel::Writer::XLSX::Examples
- https://github.com/jmcnamara/excel-writer-xlsx
he Excel::Writer::XLSX Perl module can be used to create an Excel 2007+ xlsx file on any platform that perl runs on. It supports a large range of Excel's features:
- Multiple worksheets
- Strings and numbers
- Unicode text
- Rich string formats
- Formulas (including array formulas)
- Cell formatting
- Embedded images
- Charts
- Autofilters
- Data validation
- Hyperlinks
- Defined names
- Grouping/Outlines
- Cell comments
- Panes
- Page set-up and printing options
This module will work on Windows, Linux, UNIX and Mac platforms. Generated files are also compatible with the Linux/UNIX spreadsheet applications Gnumeric and OpenOffice.org.
use strict;
use warnings;
use Excel::Writer::XLSX;
# Create a new workbook called simple.xls and add a worksheet
my $workbook = Excel::Writer::XLSX->new( 'a_simple.xlsx' );
my $worksheet = $workbook->add_worksheet();
# The general syntax is write($row, $column, $token). Note that row and
# column are zero indexed
#
# Write some text
$worksheet->write( 0, 0, "Hi Excel!" );
# Write some numbers
$worksheet->write( 2, 0, 3 ); # Writes 3
$worksheet->write( 3, 0, 3.00000 ); # Writes 3
$worksheet->write( 4, 0, 3.00001 ); # Writes 3.00001
$worksheet->write( 5, 0, 3.14159 ); # TeX revision no.?
# Write some formulas
$worksheet->write( 7, 0, '=A3 + A6' );
$worksheet->write( 8, 0, '=IF(A5>3,"Yes", "No")' );
# Write a hyperlink
my $hyperlink_format = $workbook->add_format(
color => 'blue',
underline => 1,
);
$worksheet->write( 10, 0, 'http://www.perl.com/', $hyperlink_format );
__END__