NAME

Spreadsheet::XLSX::Reader::LibXML::XMLReader::Worksheet - A class for exploring XLSX worksheets

SYNOPSIS

See the SYNOPSIS in Spreadsheet::XLSX::Reader::LibXML

DESCRIPTION

This is the class used to interrogate Excel xlsx worksheets for information. Because the Excel xlsx storage of information can be (but not always) spread across multiple xml files this class is the way to retreive information about the sheet independant of which file it is in. This is the XMLReader version of this class. Where possible this class makes the decision to read files by line rather than parse the file using a DOM tree. The up side to this is that large files will (hopefully) not crash when opened and the data will available using the same methods. The down side is that the file opens slower since the whole sheet is read twice before information is available. Additionally data is best accessed sequentially left to right and top to bottom since going back will involve a system file close and re-open action.

Attributes

Attributes of this cell are not included in the documentation because 'new' should be called by other classes in this package.

Methods

These are ways to access the data and formats in the cell. They also provide a way to modifiy the output of the format.

get_name

    Definition: Returns the sheet name

    Accepts:Nothing

    Returns: $sheet_name

row_range

    Definition: Returns the minimum row number and the maximum row number based on the settings of attribute 'count_from_zero' set when first creating the file parser with Spreadsheet::XLSX::Reader::LibXML.

    Accepts:Nothing

    Returns: a list of ( $minimum_row, $max_row )

col_range

    Definition: Returns the minimum column number and the maximum column number based on the settings of attribute 'count_from_zero' set when first creating the file parser with Spreadsheet::XLSX::Reader::LibXML.

    Accepts:Nothing

    Returns: a list of ( $minimum_column, $max_column )

get_cell( $row, $column )

    Definition: Returns a Spreadsheet::XLSX::Reader::LibXML::Cell instance corresponding to the identified $row and $column. The actual position returned are affected by the attribute 'count_from_zero' set when first creating the file parser with Spreadsheet::XLSX::Reader::LibXML. If there is no data stored in that cell it returns undef. If the $column selected is past the max_col value then it returns the string 'EOR'. If the $row selected is past the max_row value then it returns the string 'EOF'.

    If both $row and $column are left blank this is effectivly a 'get_(next)_cell' command moving left to right and top to bottom starting from either the last position identified or the sheet minimum row and column. When the end of the file is reached it returns the string 'EOF';

    If only the $row is specified it will return the next cell in that $row starting from the last column specified even if it was a different row or starting from the minimum column. When the row is finished it will return the string 'EOR' and reset the next column to be the minimum column. (The sheet starts with the minimum column as the next column on opening.) This implementation is pre-deprecated and will be removed when the 'fetchrow_arrayref' function is implemented. That that point this method will require either both $row and $column or neither.

    If only the $column is specified this will return undef and set the error message returning undef.

    Accepts: ( $row, $column ) - as indicated in the Definition

    Returns: (undef|a blessed Spreadsheet::XLSX::Reader::LibXML::Cell instance|'EOR'|'EOF')

set_warnings( $bool )

if_warn

error

clear_error

min_col

    Definition: method to read the minimum column for the sheet

    Accepts: Nothing

    Returns: $minimum_column (Integer)

has_min_col

    Definition: indicates if a minimum column has been determined

    Accepts: Nothing

    Returns: $bool TRUE = exists

min_row

    Definition: method to read the minimum row for the sheet

    Accepts: Nothing

    Returns: $minimum_row (Integer)

has_min_row

    Definition: indicates if a minimum row has been determined

    Accepts: Nothing

    Returns: $bool TRUE = exists

max_col

    Definition: method to read the maximum column for the sheet

    Accepts: Nothing

    Returns: $maximum_column (Integer)

has_max_col

    Definition: indicates if a maximum column has been determaxed

    Accepts: Nothing

    Returns: $bool TRUE = exists

max_row

    Definition: method to read the maximum row for the sheet

    Accepts: Nothing

    Returns: $maximum_row (Integer)

has_max_row

    Definition: indicates if a maximum row has been determaxed

    Accepts: Nothing

    Returns: $bool TRUE = exists

set_custom_formats( $hashref )

    Definition: It is not inconceivable that the module user would need/want the data manipulated in some way that was not provided natively by excel. This package uses the excellent Type::Tiny to implement the default data manipulations identified by the spreadsheet. However, it is possible for the user to supply a hashref of custom data manipulations. The hashref is read where the key is a row-column indicator and the value is a data manipulation coderef/object that has (at least) the following two methods. The first method is 'coerce' and the second method is 'display_name'. For each cell instance generated the get_cell method will check the cell_id (ex. B34) for matches in this hashref and then if none are found it will apply any format(data manipulation) defined in the spreadsheet. For a match on any given cell checks will be done in this order; full cell_id (ex. B34), column_id (ex. B), row_id (ex.34)

    Accepts: a $hashref (ex. { B34 => MyTypeTinyType->plus_coercions( MyCoercion ) } )

    Returns: Nothing

set_custom_format( $key => $value_ref )

    Definition: The difference with this method from set_custom_formats is this will only set specific key value pairs.

    Accepts: a $key => $value_ref list

    Returns: Nothing

get_custom_format( $key )

    Definition: This returns the custom format associated with that key

    Accepts: a $key

    Returns: The $value_ref (data manipulation ref) associated with $key

has_custom_format( $key )

    Definition: This checks if a custom format is registered against the $key

    Accepts: a $key

    Returns: $boolean representing existance

SUPPORT

TODO

    1. Add min to max next cell

    2. Add read Non-Null only next cells

    2. Add 'fetchrow_arrayref( $row )' (as a Role?)

    3. Add 'set_header_row( $row )' and 'fetchrow_hashref( $row )' (as a Role?)

    4. Add Data::Walk::Graft capabilities to 'set_custom_formats'

    5. Move 'get_cell( $row, $column )' into a role?

AUTHOR

Jed Lund
jandrew@cpan.org

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

This software is copyrighted (c) 2014 by Jed Lund

DEPENDENCIES

SEE ALSO