Catman...er::XLS(3pm)
π Catmandu::Importer::XLS β the manual, but make it make sense π
okay bestie, gather round, because this one is so useful and also the page name got absolutely mangled by whatever gremlin formatted it (it's Catmandu::Importer::XLS, section 3pm, from the User Contributed Perl Documentation crew π«Ά). Yes. It's a whole Perl module. Yes it slays. Let's go. β¨
πΈ NAME πΈ
Catmandu::Importer::XLS β the package that imports XLS files. that's it. that's the whole job. iconic behavior honestly π
π¦ SYNOPSIS π¦
you can run it from the command line, like the main character you are:
# On the command line
$ catmandu convert XLS < ./t/test.xls
$ catmandu convert XLS --header 0 < ./t/test.xls
$ catmandu convert XLS --fields 1,2,3 < ./t/test.xls
$ catmandu convert XLS --columns 1 < ./t/test.xls
$ catmandu convert XLS --worksheet 1 < ./t/test.xls
or, if you're a Perl girlie (respect π), you do it in Perl:
# Or in Perl
use Catmandu::Importer::XLS;
my $importer = Catmandu::Importer::XLS->new(file => "./t/test.xls");
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
like. look at that. each gives you a $hashref per row and you do whatever your heart desires with it. no cap. π
π DESCRIPTION π
It's a Catmandu importer for XLS files. that's the vibe. that's the whole vibe check. β
β¨ METHODS β¨
This module inherits all the methods of Catmandu::Importer, and through that, all of Catmandu::Iterable. So everything those two can do, this one can do too β nothing extra to memorize, just the family inheritance working its magic. π§
π CONFIGURATION π
So obviously you get everything Catmandu::Importer already gives you (file, fh, etc. β the usual suspects), and on top of that this importer takes these extra parameters. Obsessed with the options honestly:
headerβ by default, the object fields get read straight from the XLS header line. If there is no header line available, the object fields get named after column coordinates instead (A,B,C,...). Default:1.fieldsβ give it custom object field names. You can hand them over as an array, a hash reference, or a comma-separated list. your call, bestie, whatever format your heart says π«columnsβ when you pass thecolumnsoption, the object fields get named as column coordinates (A,B,C,...). Default:0.emptyβ this is the "how do we treat empty fields in the data" setting, and she has layers:- when the option value is
'string', the empty values become empty strings. - when the option value is
'nil', the empty values get turned into undefined fields. - when the option is
'ignore', the empty values are ignored. - Default is
'string'.
- when the option value is
worksheetβ if your Excel workbook contains more than one worksheet, you can select a specific one by its index number (0,1,2,...). Default:0.
ngl theemptyoption is doing the most and I respect her for it. pick your fighter:'string','nil', or'ignore'. π
π SEE ALSO π
go read these too, they're the friend group:
Catmandu::ImporterCatmandu::IterableCatmandu::Importer::CSVCatmandu::Importer::XLSX
and that's the whole page bestie!! π₯³ this was written for perl v5.40.1, dated 2026-01-24, and it's page Catmandu::Importer::XLS(3pm) of the User Contributed Perl Documentation. mwah. go import some spreadsheets. πβ¨π¦π
π¦ where this page comes from
- ubuntu resolute: libcatmandu-xls-perl 0.11-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-xls-perl 0.11-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms