perldoc > Spreadsheet::ParseExcel::Worksheet

get_tab_color()

📘 NAME

Spreadsheet::ParseExcel::Worksheet — A class for Worksheets.

🚀 Quick Reference

Use CaseCommandDescription
Get cell value$worksheet->get_cell($row, $col)Return the Cell object at row $row and column $col, or undef.
Get row range$worksheet->row_range()Return min and max defined rows.
Get column range$worksheet->col_range()Return min and max defined columns.
Get worksheet name$worksheet->get_name()Return the name of the worksheet.
Get merged areas$worksheet->get_merged_areas()Return array ref of merged cell ranges.
Get print settings$worksheet->is_portrait() etc.Check various print options (portrait, gridlines, etc.).

📖 SYNOPSIS

See the documentation for Spreadsheet::ParseExcel.

📝 DESCRIPTION

This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel.

🔧 Methods

The Spreadsheet::ParseExcel::Worksheet class encapsulates the properties of an Excel worksheet. It has the following methods:

🔍 get_cell($row, $col)

Return the Cell object at row $row and column $col if it is defined. Otherwise returns undef.

my $cell = $worksheet->get_cell($row, $col);

🔍 row_range()

Returns a two-element list ($min, $max) containing the minimum and maximum defined rows in the worksheet. If there is no row defined $max is smaller than $min.

my ( $row_min, $row_max ) = $worksheet->row_range();

🔍 col_range()

Returns a two-element list ($min, $max) containing the minimum and maximum of defined columns in the worksheet. If there is no column defined $max is smaller than $min.

my ( $col_min, $col_max ) = $worksheet->col_range();

🔍 get_name()

The get_name() method returns the name of the worksheet.

my $name = $worksheet->get_name();

🔍 get_h_pagebreaks()

The get_h_pagebreaks() method returns an array ref of row numbers where a horizontal page break occurs.

my $h_pagebreaks = $worksheet->get_h_pagebreaks();

Returns undef if there are no pagebreaks.

🔍 get_v_pagebreaks()

The get_v_pagebreaks() method returns an array ref of column numbers where a vertical page break occurs.

my $v_pagebreaks = $worksheet->get_v_pagebreaks();

Returns undef if there are no pagebreaks.

🔍 get_merged_areas()

The get_merged_areas() method returns an array ref of cells that are merged.

my $merged_areas = $worksheet->get_merged_areas();

Each merged area is represented as follows:

[ $start_row, $start_col, $end_row, $end_col]

Returns undef if there are no merged areas.

🔍 get_row_heights()

The get_row_heights() method returns an array_ref of row heights in scalar context, and an array in list context.

my $row_heights = $worksheet->get_row_heights();

Returns undef if the property isn't set.

🔍 get_col_widths()

The get_col_widths() method returns an array_ref of column widths in scalar context, and an array in list context.

my $col_widths = $worksheet->get_col_widths();

Returns undef if the property isn't set.

🔍 get_default_row_height()

The get_default_row_height() method returns the default row height for the worksheet. Generally 12.75.

my $default_row_height = $worksheet->get_default_row_height();

🔍 get_default_col_width()

The get_default_col_width() method returns the default column width for the worksheet. Generally 8.43.

my $default_col_width = $worksheet->get_default_col_width();

🔍 get_header()

The get_header() method returns the worksheet header string. This string can contain control codes for alignment and font properties. Refer to the Excel on-line help on headers and footers or to the Spreadsheet::WriteExcel documentation for set_header().

my $header = $worksheet->get_header();

Returns undef if the property isn't set.

🔍 get_footer()

The get_footer() method returns the worksheet footer string. This string can contain control codes for alignment and font properties. Refer to the Excel on-line help on headers and footers or to the Spreadsheet::WriteExcel documentation for set_header().

my $footer = $worksheet->get_footer();

Returns undef if the property isn't set.

🔍 get_margin_left()

The get_margin_left() method returns the left margin of the worksheet in inches.

my $margin_left = $worksheet->get_margin_left();

Returns undef if the property isn't set.

🔍 get_margin_right()

The get_margin_right() method returns the right margin of the worksheet in inches.

my $margin_right = $worksheet->get_margin_right();

Returns undef if the property isn't set.

🔍 get_margin_top()

The get_margin_top() method returns the top margin of the worksheet in inches.

my $margin_top = $worksheet->get_margin_top();

Returns undef if the property isn't set.

🔍 get_margin_bottom()

The get_margin_bottom() method returns the bottom margin of the worksheet in inches.

my $margin_bottom = $worksheet->get_margin_bottom();

Returns undef if the property isn't set.

🔍 get_margin_header()

The get_margin_header() method returns the header margin of the worksheet in inches.

my $margin_header = $worksheet->get_margin_header();

Returns a default value of 0.5 if not set.

🔍 get_margin_footer()

The get_margin_footer() method returns the footer margin of the worksheet in inches.

my $margin_footer = $worksheet->get_margin_footer();

Returns a default value of 0.5 if not set.

🔍 get_paper()

The get_paper() method returns the printer paper size.

my $paper = $worksheet->get_paper();

The value corresponds to the formats shown below:

IndexPaper formatPaper size
0Printer default-
1Letter8 1/2 x 11 in
2Letter Small8 1/2 x 11 in
3Tabloid11 x 17 in
4Ledger17 x 11 in
5Legal8 1/2 x 14 in
6Statement5 1/2 x 8 1/2 in
7Executive7 1/4 x 10 1/2 in
8A3297 x 420 mm
9A4210 x 297 mm
10A4 Small210 x 297 mm
11A5148 x 210 mm
12B4250 x 354 mm
13B5182 x 257 mm
14Folio8 1/2 x 13 in
15Quarto215 x 275 mm
16-10x14 in
17-11x17 in
18Note8 1/2 x 11 in
19Envelope 93 7/8 x 8 7/8
20Envelope 104 1/8 x 9 1/2
21Envelope 114 1/2 x 10 3/8
22Envelope 124 3/4 x 11
23Envelope 145 x 11 1/2
24C size sheet-
25D size sheet-
26E size sheet-
27Envelope DL110 x 220 mm
28Envelope C3324 x 458 mm
29Envelope C4229 x 324 mm
30Envelope C5162 x 229 mm
31Envelope C6114 x 162 mm
32Envelope C65114 x 229 mm
33Envelope B4250 x 353 mm
34Envelope B5176 x 250 mm
35Envelope B6176 x 125 mm
36Envelope110 x 230 mm
37Monarch3.875 x 7.5 in
38Envelope3 5/8 x 6 1/2 in
39Fanfold14 7/8 x 11 in
40German Std Fanfold8 1/2 x 12 in
41German Legal Fanfold8 1/2 x 13 in
256User defined

The two most common paper sizes are "1 = US Letter" and "9 = A4". Returns 9 by default.

🔍 get_start_page()

The get_start_page() method returns the page number that printing will start from.

my $start_page = $worksheet->get_start_page();

Returns 0 if the property isn't set.

🔍 get_print_order()

The get_print_order() method returns 0 if the worksheet print "page order" is "Down then over" (the default) or 1 if it is "Over then down".

my $print_order = $worksheet->get_print_order();

🔍 get_print_scale()

The get_print_scale() method returns the workbook scale for printing. The print scale factor can be in the range 10 .. 400.

my $print_scale = $worksheet->get_print_scale();

Returns 100 by default.

🔍 get_fit_to_pages()

The get_fit_to_pages() method returns the number of pages wide and high that the printed worksheet page will fit to.

my ($pages_wide, $pages_high) = $worksheet->get_fit_to_pages();

Returns (0, 0) if the property isn't set.

🔍 is_portrait()

The is_portrait() method returns true if the worksheet has been set for printing in portrait mode.

my $is_portrait = $worksheet->is_portrait();

Returns 0 if the worksheet has been set for printing in horizontal mode.

🔍 is_centered_horizontally()

The is_centered_horizontally() method returns true if the worksheet has been centered horizontally for printing.

my $is_centered_horizontally = $worksheet->is_centered_horizontally();

Returns 0 if the property isn't set.

🔍 is_centered_vertically()

The is_centered_vertically() method returns true if the worksheet has been centered vertically for printing.

my $is_centered_vertically = $worksheet->is_centered_vertically();

Returns 0 if the property isn't set.

🔍 is_print_gridlines()

The is_print_gridlines() method returns true if the worksheet print "gridlines" option is turned on.

my $is_print_gridlines = $worksheet->is_print_gridlines();

Returns 0 if the property isn't set.

🔍 is_print_row_col_headers()

The is_print_row_col_headers() method returns true if the worksheet print "row and column headings" option is turned on.

my $is_print_row_col_headers = $worksheet->is_print_row_col_headers();

Returns 0 if the property isn't set.

🔍 is_print_black_and_white()

The is_print_black_and_white() method returns true if the worksheet print "black and white" option is turned on.

my $is_print_black_and_white = $worksheet->is_print_black_and_white();

Returns 0 if the property isn't set.

🔍 is_print_draft()

The is_print_draft() method returns true if the worksheet print "draft" option is turned on.

my $is_print_draft = $worksheet->is_print_draft();

Returns 0 if the property isn't set.

🔍 is_print_comments()

The is_print_comments() method returns true if the worksheet print "comments" option is turned on.

my $is_print_comments = $worksheet->is_print_comments();

Returns 0 if the property isn't set.

👤 AUTHOR

Current maintainer 0.60+: Douglas Wilson dougw AT cpan.org

Maintainer 0.40-0.59: John McNamara jmcnamara AT cpan.org

Maintainer 0.27-0.33: Gabor Szabo szabgab AT cpan.org

Original author: Kawai Takanori kwitknr AT cpan.org

©️ COPYRIGHT

Copyright (c) 2014 Douglas Wilson

Copyright (c) 2009-2013 John McNamara

Copyright (c) 2006-2008 Gabor Szabo

Copyright (c) 2000-2006 Kawai Takanori

All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

Spreadsheet::ParseExcel::Worksheet
get_tab_color() 📘 NAME 🚀 Quick Reference 📖 SYNOPSIS 📝 DESCRIPTION 🔧 Methods
🔍 get_cell($row, $col) 🔍 row_range() 🔍 col_range() 🔍 get_name() 🔍 get_h_pagebreaks() 🔍 get_v_pagebreaks() 🔍 get_merged_areas() 🔍 get_row_heights() 🔍 get_col_widths() 🔍 get_default_row_height() 🔍 get_default_col_width() 🔍 get_header() 🔍 get_footer() 🔍 get_margin_left() 🔍 get_margin_right() 🔍 get_margin_top() 🔍 get_margin_bottom() 🔍 get_margin_header() 🔍 get_margin_footer() 🔍 get_paper() 🔍 get_start_page() 🔍 get_print_order() 🔍 get_print_scale() 🔍 get_fit_to_pages() 🔍 is_portrait() 🔍 is_centered_horizontally() 🔍 is_centered_vertically() 🔍 is_print_gridlines() 🔍 is_print_row_col_headers() 🔍 is_print_black_and_white() 🔍 is_print_draft() 🔍 is_print_comments()
👤 AUTHOR ©️ COPYRIGHT

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-16 10:23 @216.73.216.87
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^