while (<$fh>) {
chomp;
# parse the line
- die "Unable to parse line $. of $file" unless $csv->parse($_);
+ die "Unable to parse line $. of $file: ".$csv->error_diag() unless $csv->parse($_);
my @row = $csv->fields();
if ($row==1 and not $r_mode_autodetected) {
@header_row = @row;
my $t_ws_name = $ws_name;
my $maxlen = 31-length('.'.$overflow);
$t_ws_name =~ s{^(.{0,$maxlen}).*$}{$1};
- $ws = $wb->add_worksheet($ws_name.'.'.$overflow);
+ $ws = $wb->add_worksheet($t_ws_name.'.'.$overflow);
+ $overflow++;
$row=1;
output_row(\@header_row,$row,$ws,$wb,\%wb_formats,\%options);
$row++;