Catman...::XLSX(3pm)

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

πŸ’– Catmandu::Exporter::XLSX β€” the whole vibe πŸ’–

okay bestie, so this page lives in the Catman...::XLSX part of the 3pm manual (yes that's the name, we don't make the rules) and it's literally all about Catmandu::Exporter::XLSX, which is β€” drumroll please πŸ₯ β€” a XLSX exporter. That's it. That's the name section. Slay.


✨ SYNOPSIS ✨

first up, the command line era, because she contains multitudes:

# On the command line
$ printf "a,b,c\n1,2,3" | catmandu convert CSV to XLSX --file test.xlsx
$ printf "a,b,c\n1,2,3" | catmandu convert CSV to XLSX --file test.xlsx --header 0
$ printf "a,b,c\n1,2,3" | catmandu convert CSV to XLSX --file test.xlsx --fields a,c
$ printf "a,b,c\n1,2,3" | catmandu convert CSV to XLSX --file test.xlsx --fields a,c --columns ALPHA,CHARLIE

and now the Perl girlies get their moment 🫢

# Or in Perl
use Catmandu::Exporter::XLSX;

my $exporter = Catmandu::Exporter::XLSX->new(
            file => 'test.xlsx',
            fields => 'a,b,c',
            columns => 'ALPHA,BRAVO,CHARLIE',
            header => 1);

$exporter->add({a => 1, b => 2, c => 3});
$exporter->add_many($arrayref);

$exporter->commit;

printf "exported %d objects\n" , $exporter->count;

look at her go. add, add_many, commit, then flexing with count. main character energy fr fr. πŸ‘‘


🌸 DESCRIPTION 🌸

Catmandu exporter for Excel XLSX files. that's the whole thing. she takes your data and she makes it a spreadsheet. iconic behavior, no notes. πŸ’…


πŸ¦‹ METHODS πŸ¦‹

want the full list of methods? bestie you gotta go read Catmandu::Exporter, Catmandu::Addable, Catmandu::Fixable, Catmandu::Counter, and Catmandu::Logger. they've got the whole menu. this page is just the XLSX-specific corner of the group chat. 😌


πŸŽ€ CONFIGURATION πŸŽ€

so besides all the config that Catmandu::Exporter already hands you (think "file", "fh", etc. β€” the classics), this importer can be configured with the following parameters. yes it says "importer" in the original and yes we're keeping it, don't @ me:

  • header β€” include a header line with the column names? set it to 1 and you get one. that's the default, so if you say nothing you still get a header. πŸ’–
  • fields β€” the list of fields that get used as columns. hand it over as an array reference or as a comma-separated string, dealer's choice.
  • columns β€” the list of custom column names. again: array reference, or a comma-separated list. ✨
  • collect_fields β€” okay this one's the overthinker of the group. turn it on and she will first read the complete stream so she can build a complete list of fields to export. leave it off and only the fields from the first record get exported β€” or, if you used the "fields" option, just the ones you named there. so if your records are all "surprise! I have extra keys", this is your girl. 🌈

🧚 SEE ALSO 🧚

go give these two a follow, they're in the same friend group:

  • Catmandu::Exporter::CSV
  • Catmandu::Exporter::XLS

lowkey a whole manual page and she ate. πŸ’€

and that's the tea, bestie β€” this page is from perl v5.40.1, dated 2026-01-24, and it was written by the User Contributed Perl Documentation girlies (that's the Catman...::XLSX(3pm) corner of the internet, iykyk). stay slay, go export something pretty. πŸ“βœ¨

πŸ“¦ where this page comes from