Spreadsheet::XlateExcel - Trigger a callback subroutine on each row of an Excel spreadsheet
Version 0.03
This modules triggers a callback subroutine on each row of an Excel spreadsheet.
Wrote this simple module because I was fed up from writing the same boilerplate code ever when I had to mine spreadsheets for data.
Operates on every sheet unless a given sheet is targeted by name, RE inclusion or RE exclusion.
Operates on every column unless targeted by column head name or RE (inclusion).
For example:
use Spreadsheet::XlateExcel; my $id = Spreadsheet::XlateExcel->new ({ file => 'sheet.xls' }); # rip odd rows of "Sheet2" sheet my $lol; $id->xlate ({ on_sheet_named => 'Sheet2', for_each_row_do => sub { my ( $sheet_id, $row, $row_vs ) = @_; push @$lol, $row_vs unless $row % 2; }, });
my $id = Spreadsheet::XlateExcel->new ({ file => 'sheet.xls' [, formatter => Spreadsheet::ParseExcel::Fmt->new })
Ye constructor.
Optional formatter attribute is a Spreadsheet::ParseExcel formatter instance. Refer to http://metacpan.org/module/Spreadsheet::ParseExcel#parse-filename-formatter- for more about such formatters.
$self->xlate ({ for_each_row_do => sub { my ( $sheet_id, $row, $row_vs ) = @_ ; ... } })
Applies for_each_row_do sub to each row of each sheet (unless filtered, see below) of the book.
for_each_row_do
Options:
on_sheet_named: targets a given book sheet by name
on_sheet_named
on_sheets_like: targets a given book sheet by RE inclusion on name
on_sheets_like
on_sheets_unlike: targets a given book sheet by RE exclusion on name
on_sheets_unlike
on_columns_heads_named: targets columns via a listref of strings
on_columns_heads_named
on_columns_heads_like: targets columns via a listref of regular expressions
on_columns_heads_like
Callback function gets called for each row, fed with Spreadsheet::ParseExcel::Worksheet ID, row index and arrayref of row values parameters.
Returns self.
my $book_id = $self->book_id ()
Accessor to Spreadsheet::ParseExcel::Workbook instance ID.
Xavier Caron, <xav at cpan.org>
<xav at cpan.org>
Please report any bugs or feature requests to bug-spreadsheet-xlateexcel at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Spreadsheet-XlateExcel. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-spreadsheet-xlateexcel at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Spreadsheet::XlateExcel
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Spreadsheet-XlateExcel
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Spreadsheet-XlateExcel
CPAN Ratings
http://cpanratings.perl.org/d/Spreadsheet-XlateExcel
Search CPAN
http://search.cpan.org/dist/Spreadsheet-XlateExcel/
Code is available through github (http://github.com/maspalio/Spreadsheet-XlateExcel).
To Kawai Takanori, Gabor Szabo and John McNamara, authors of cool http://search.cpan.org/dist/Spreadsheet-ParseExcel/ module.
Copyright 2010 Xavier Caron.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Spreadsheet::XlateExcel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Spreadsheet::XlateExcel
CPAN shell
perl -MCPAN -e shell install Spreadsheet::XlateExcel
For more information on module installation, please visit the detailed CPAN module installation guide.