# perldoc > Spreadsheet::ParseExcel::Workbook

---
type: CommandReference
command: Spreadsheet::ParseExcel::Workbook
mode: perldoc
section: ~
source: perldoc
---

## Quick Reference

- `$workbook->worksheets()` — returns array of Worksheet objects
- `$workbook->worksheet($name_or_index)` — returns single Worksheet by name or index
- `$workbook->worksheet_count()` — returns number of worksheets
- `$workbook->get_filename()` — returns Excel filename or undef
- `$workbook->get_print_areas()` — returns array ref of print areas
- `$workbook->get_print_titles()` — returns array ref of print title hash refs
- `$workbook->using_1904_date()` — returns true if using 1904 date epoch
- `$workbook->get_active_sheet()` — returns number of active worksheet at save time

## Name

[Spreadsheet::ParseExcel::Workbook](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel%3A%3AWorkbook/markdown) — A class for Workbooks.

## Synopsis

See the documentation for [Spreadsheet::ParseExcel](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel/markdown).

## Options

- `$workbook->worksheets()` — returns an array of Worksheet objects. Commonly used to iterate:
  ```perl
  for my $worksheet ( $workbook->worksheets() ) { ... }
  
- `$workbook->worksheet($name_or_index)` — returns a single Worksheet object by name or index:
  ```perl
  $worksheet = $workbook->worksheet('Sheet1');
  $worksheet = $workbook->worksheet(0);
  
  Returns `undef` if sheet name or index doesn't exist.
- `$workbook->worksheet_count()` — returns the number of Worksheet objects in the Workbook.
- `$workbook->get_filename()` — returns the name of the Excel file, or `undef` if data was read from a filehandle.
- `$workbook->get_print_areas()` — returns an array ref of print areas. Each print area: `[ $start_row, $start_col, $end_row, $end_col ]`. Returns `undef` if none.
- `$workbook->get_print_titles()` — returns an array ref of print title hash refs. Each hash: `{ Row => [ $start_row, $end_row ], Column => [ $start_col, $end_col ] }`. Returns `undef` if none.
- `$workbook->using_1904_date()` — returns true if using 1904 date epoch (Mac), false (0) if 1900 epoch (Windows).
- `$workbook->get_active_sheet()` — returns the number of the active worksheet at the time the workbook was saved. May return `undef`.

## Examples

Iterate over worksheets:
perl
for my $worksheet ( $workbook->worksheets() ) {
    # process each worksheet
}
Get a single worksheet by name:
perl
my $worksheet = $workbook->worksheet('Sheet1');
Get print areas:
perl
my $print_areas = $workbook->get_print_areas();
if ($print_areas) {
    for my $area (@$print_areas) {
        my ($start_row, $start_col, $end_row, $end_col) = @$area;
    }
}
Check date epoch:
perl
my $using_1904 = $workbook->using_1904_date();
## See Also

[Spreadsheet::ParseExcel](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel/markdown)

## Exit Codes

Not documented.