Spreadsheet::WriteExcel - data_validation
- by sid_com
#! /usr/bin/env perl
use warnings;
use 5.012;
use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new( 'test_test.xls' ) or die $!;
my $sheet = $workbook->add_worksheet();
my $format_in = $workbook->add_format( align => 'center', valign => 'vcenter' );
my $format_st = $workbook->add_format( align => 'center', valign => 'vcenter' );
$format_in->set_num_format ( 'hh:mm' );
$format_st->set_num_format ( '[h]:mm' );
$sheet->set_row( 0, 22 );
$sheet->set_row( 1, 22 );
$sheet->set_column( 'A:D', 20, $format_in );
$sheet->set_column( 'E:E', 20, $format_st );
$sheet->write( 'A1', 'begin am' );
$sheet->write( 'B1', 'end am' );
$sheet->write( 'C1', 'begin pm' );
$sheet->write( 'D1', 'end pm' );
$sheet->write( 'E1', 'time' );
$sheet->data_validation( 'A2:D2', {
validate => 'time',
criteria => 'between',
minimum => 'T06:00',
maximum => 'T20:00',
});
$sheet->write_formula( 'E2', '=(B2-A2)+(D2-C2)' );
$workbook->close() or die $!;
Which kind of data_validation would check if the "end am"-value is greater than the "begin am"-value (and "end pm" grater then "begin pm")?
I tried this, but it didn't work:
$sheet->data_validation( 'B2', {
validate => 'time',
criteria => '>=',
value => '=A2',
});
$sheet->data_validation( 'D2', {
validate => 'time',
criteria => '>=',
value => '=C2',
});
Spreadsheet::WriteExcel