Catman...er::XLS(3pm)

πŸ“¦
version 0.11 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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 the columns option, 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'.
  • 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 the empty option 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::Importer
  • Catmandu::Iterable
  • Catmandu::Importer::CSV
  • Catmandu::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