-   Linux - Newbie (
-   -   ( Excel::Writer::XLSX->new) question: how to open single sheet by name (

PoleStar 04-30-2013 09:52 PM

( Excel::Writer::XLSX->new) question: how to open single sheet by name

I went through cpan page of (Excel::Writer::XLSX)
It only say one method which is open document, and all the sheets will be read into
an array, then you loop array to do some thing with sheets.

In my case I only have one sheet, I did datadump on object


my $workbook = Excel::Writer::XLSX->new( 'B.xlsx' ) ;

print Dumper $workbook;

but did not get any thing I could use.
So how do address one sheet with out looping into array.

normanlinux 05-01-2013 04:06 AM

Please clarify. Are you trying to use Libreoffice to handle this document?

"It only say one method" to what does 'it' refer?

jdkaye 05-01-2013 05:39 AM

xlsx is a Microsoft format for a spreadsheet. Are you trying to convert that to an .ods format, which is an opendocument format for a spreadsheet?

j-ray 05-01-2013 06:21 AM

This perl module cannot be used to write to an existing excel file. It can create new files only.



The Excel::Writer::XLSX module can be used to create an Excel file in the 2007+ XLSX format.

The XLSX format is the Office Open XML (OOXML) format used by Excel 2007 and later.

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.

This module cannot, as yet, be used to write to an existing Excel XLSX file.

use Excel::Writer::XLSX;

# Create a new Excel workbook
my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' );

# Add a worksheet
$worksheet = $workbook->add_worksheet();
If you use Spreadsheet::ParseExcel you usually loop through te worksheets with
something like
for my $worksheet ( $workbook->worksheets() ) {


my @sheets = $workbook->worksheets();
$sheets[0] will contain the first element.

So what's the problem with that?

All times are GMT -5. The time now is 11:10 AM.