App-CSVUtils

 view release on metacpan or  search on metacpan

script/csv-check-cell-values  view on Meta::CPAN

);

$cmdline->run;

# ABSTRACT: Check the value of single cells of CSV against code/schema/regex
# PODNAME: csv-check-cell-values

__END__

=pod

=encoding UTF-8

=head1 NAME

csv-check-cell-values - Check the value of single cells of CSV against code/schema/regex

=head1 VERSION

This document describes version 1.036 of csv-check-cell-values (from Perl distribution App-CSVUtils), released on 2025-02-04.

=head1 SYNOPSIS

B<csv-check-cell-values> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<csv-check-cell-values> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<csv-check-cell-values> [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--exclude-field-pat|/"--exclude-field-pat=s">>=I<re>|B<L<-A|/"--exclud...



See examples in the L</EXAMPLES> section.

=head1 DESCRIPTION

Example C<input.csv>:

 ingredient,%weight
 foo,81
 bar,9
 baz,10

Check that ingredients do not contain number:

 % csv-check-cell-values input.csv -f ingredient --with-regex '/\\A[A-Za-z ]+\\z/'

Check that all %weight is between 0 and 100:

 % csv-check-cell-values input.csv -f %weight --with-code '$_>0 && $_<=100'

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--ignore-unknown-fields>

When unknown fields are specified in --include-field (--field) or --exclude-field options, ignore them instead of throwing an error.

=item B<--input-skip-num-lines>=I<s>

Number of lines to skip before header row.

This can be useful if you have a CSV files (usually some generated reports,
sometimes converted from spreadsheet) that have additional header lines or info
before the CSV header row.

See also the alternative option: C<--input-skip-until-pattern>.


=item B<--input-skip-until-pattern>=I<s>

Skip rows until the first header row matches a regex pattern.

This is an alternative to the C<--input-skip-num-lines> and can be useful if you
have a CSV files (usually some generated reports, sometimes converted from
spreadsheet) that have additional header lines or info before the CSV header
row.

With C<--input-skip-num-lines>, you skip a fixed number of lines. With this
option, rows will be skipped until the first field matches the specified regex
pattern.


=item B<--print-validated>

Print the validated values of each cell.

When validating with schema, will print each validated (possible coerced,
filtered) value of each cell.


=item B<--quiet-arg>, B<-q>

(No description)


=item B<--show-selected-fields>

Show selected fields and then immediately exit.

=item B<--with-code-json>=I<s>

Check with Perl code (JSON-encoded).

See C<--with-code>.

=item B<--with-code>=I<s>

Check with Perl code.

Code will be given the value of the cell and should return a true value if value
is valid.


=item B<--with-regex>=I<s>

(No description)



( run in 0.471 second using v1.01-cache-2.11-cpan-39bf76dae61 )