The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::CPANModules::WorkingWithCSV - Working with CSV (comma-separated value) data in Perl

VERSION

This document describes version 0.001 of Acme::CPANModules::WorkingWithCSV (from Perl distribution Acme-CPANModules-WorkingWithCSV), released on 2022-07-27.

DESCRIPTION

The following are tools (modules and scripts) to work with the CSV format:

Parsing

First things first, the most important module to work with CSV in Perl is Text::CSV (which will use Text::CSV_XS backend when possible but fall back to Text::CSV_PP otherwise). It's not in core, but only a cpanm command away.

Generating CSV from Perl array/structure

Text::CSV (as well as Text::CSV_XS) can render a line of CSV from Perl array(ref) with their say() method.

dd2csv from App::CSVUtils

Perinci::CmdLine framework can render function result (CLI output) as CSV.

Converting to/from other formats

INI: ini2csv from App::TextTableUtils

TSV: csv2tsv and Ltsv2csv from App::CSVUtils

LTSV: csv2ltsv from App::CSVUtils and Lltsv2csv from App::LTSVUtils

XLS and XLSX: csv2tsv and tsv2csv from App::CSVUtils

JSON: csv2json and json2csv from App::TextTableUtils

Markdown table: csv2mdtable from App::TextTableUtils

Org table: csv2orgtable from App::TextTableUtils

SQLite database: csv2sqlite from App::SQLiteUtils

Rendering as text/ASCII table

csv2texttable from App::TextTableUtils

Changing field separator character, field quote character, and/or escape character

csv-csv from App::CSVUtils

Adding/removing columns

csv-add-field, csv-delete-field, csv-select-fields from App::CSVUtils

Processing columns of CSV with Perl code

csv-munge-field from App::CSVUtils

Processing rows of CSV with Perl code

Aside from the obvious Text::CSV, you can also use csv-each-row, csv-munge-row, csv-mp from App::CSVUtils.

Merging several CSV files into one

csv-concat from App::CSVUtils

Splitting a CSV file into several

csv-split from App::CSVUtils

Sorting CSV rows

csv-sort from App::CSVUtils

Sorting CSV columns

csv-sort-fields from App::CSVUtils

Filtering CSV columns

csv-select-fields from App::CSVUtils

Filtering CSV rows

csv-grep and csv-select-rows from App::CSVUtils

csvgrep from csvgrep

Transposing CSV

csv-transpose from App::CSVUtils

Summing and averaging rows

csv-sum and csv-avg from App::CSVUtils

Producing frequency table from CSV

csv-freqtable from App::CSVUtils

Performing set operations (intersection, union, difference) on CSV

csv-setop from App::CSVUtils

ACME::CPANMODULES ENTRIES

FAQ

What is an Acme::CPANModules::* module?

An Acme::CPANModules::* module, like this module, contains just a list of module names that share a common characteristics. It is a way to categorize modules and document CPAN. See Acme::CPANModules for more details.

What are ways to use this Acme::CPANModules module?

Aside from reading this Acme::CPANModules module's POD documentation, you can install all the listed modules (entries) using cpanm-cpanmodules script (from App::cpanm::cpanmodules distribution):

 % cpanm-cpanmodules -n WorkingWithCSV

Alternatively you can use the cpanmodules CLI (from App::cpanmodules distribution):

    % cpanmodules ls-entries WorkingWithCSV | cpanm -n

or Acme::CM::Get:

    % perl -MAcme::CM::Get=WorkingWithCSV -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n

or directly:

    % perl -MAcme::CPANModules::WorkingWithCSV -E'say $_->{module} for @{ $Acme::CPANModules::WorkingWithCSV::LIST->{entries} }' | cpanm -n

This Acme::CPANModules module also helps lcpan produce a more meaningful result for lcpan related-mods command when it comes to finding related modules for the modules listed in this Acme::CPANModules module. See App::lcpan::Cmd::related_mods for more details on how "related modules" are found.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Acme-CPANModules-WorkingWithCSV.

SOURCE

Source repository is at https://github.com/perlancar/perl-Acme-CPANModules-WorkingWithCSV.

SEE ALSO

App::CSVUtils::Manual::Cookbook

The See Also section in App::CSVUtils documentation

Acme::CPANModules - about the Acme::CPANModules namespace

cpanmodules - CLI tool to let you browse/view the lists

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by perlancar <perlancar@cpan.org>.

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

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-WorkingWithCSV

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.