When writing your CSV, you should use Text::CSV_XS instead of using print to write the data.
My approach to writing a CSV file from data would be to convert the Excel data to an array of arrays and then write that out through the csv function of Text::CSV_XS. See the reply by Tux for better code, but this is the basic idea:
... my $sheet = []; foreach my $row_index ($source_sheet->row_range) { my $row = []; foreach my $col_index ($source_sheet->col_range) { my $source_cell = $source_sheet->{Cells}[$row_index][$col_index]; if ($source_cell) { #print "( $row_index , $col_index ) =>", $source_cell->Value, ","; push @$row, $source_cell->Value; } } push @$sheet, $row; } csv( in => $sheet, out => 'file.csv' );
See the documentation of Text::CSV_XS on the csv function.
In reply to Re: XLS to CSV file with Text wrap
by Corion
in thread XLS to CSV file with Text wrap
by kshitij
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |