dilshod / xlsx2csv

Convert xslx to csv, it is fast, and works for huge xlsx files
MIT License
1.66k stars 302 forks source link

column values with line breaks #211

Open mariomuja opened 3 years ago

mariomuja commented 3 years ago

it would be great to have an option to replace each line break in a field value by a single space character

currently, line breaks are preserved in the resulting text file and this stops me from further processing with SQL Server Integration Services (ssis cannot manage line breaks in csv files) - I had to implement an additional process that replaces line breaks in field values

hope for your understanding :-) regards, Mario

radoeka commented 3 years ago

@mariomuja, it' similar to this request: #204 (Remove colums during conversion). Your request may help me as well.

radoeka commented 3 years ago

The developer pushed a new commit, in which he added a "--no-line-breaks" option, it replaces line breaks with spaces. Please give it a try. PS: there is a similar argument available, called "--escape".

radoeka commented 3 years ago

The newly added argument "--no-line-breaks" works for me.

This issue can be closed.

mariomuja commented 3 years ago

do not like this solution - not very nice to be forced to modify source data

instead of replacing line feeds by spaces, please allow us to set the escape character for the csv.writer call - then i can escape line feeds with whatever i like and later restore them to avoid deviations from the datasource; also see my new issue .. "--escape" is not very helpful, too

christoph-ender commented 1 year ago

I agree to mariomuja, I want to replace line breaks by the character \n. By the way then I could get rid of the quotes. Using the options "--escape" and "--quoting None" currently causes an exception.