The difference between the csv2xls.pl program choking or not choking on the final output file depends only upon whether lines of data were filtered out. If I remove the "or next" I get back my original file, and it converts to Excel just fine, ableit loaded with far too much data.
Well, I'm sorry, but you're going to have to prove that, by posting a runnable snippet of code with appropriate data that demonstrates your problem.
I tried writing a little snippet of code with data to replicate what you describe, and I didn't see any problem:
I gather your system has both Text::CSV and Text::CSV_XS installed (and former uses the latter when it's available), but since you say CSV_XS reported the error, I used that explicitly. (You can set it back to Text::CSV if you want.)#!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; # this is what reported an error, right? my $target = ( @ARGV ) ? shift : 'egik'; my $csv = Text::CSV_XS->new; my @keep; while ( my $row = $csv->getline( \*DATA )) { $row->[4] =~ /[$target]/ or next; push @keep, $row; } print join( " : ", @$_ )."\n" for ( @keep ); __DATA__ a,b,"c,c",d,e,f,g,h b,c,d,e,"f,f",g,h,i c,d,e,f,g,h,"i,i",j "d,d",e,f,g,h,i,j,k e,f,g,h,i,j,k,"l,l" f,"g,g",h,i,j,k,l,m g,h,i,"j,j",k,l,m,n h,i,j,k,l,"m,m",n,o
By default, the test script (let's call it "test_script") outputs four lines from the test data. If I put one or more matchable letters as a command line arg, it will output as many lines as match the given letters (e.g. test_script f will output 1 line, test_script e-l will output all 8 lines). No problems with quoted fields, even though each line has a quoted field somewhere in it.
So see if you can post a similar snippet that proves the problem you are talking about.
In reply to Re: CSV_XS ERROR: 2027 - EIQ - Quoted field not terminated @ pos 408
by graff
in thread CSV_XS ERROR: 2027 - EIQ - Quoted field not terminated @ pos 408
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |