dilshod/xlsx2csv

"need to escape but no escapechar set"

mariomuja opened this issue · 1 comments

"need to escape but no escapechar set"

got this error and fixed it by adding the bold part to line 283

        writer = csv.writer(outfile, quoting=self.options['quoting'], delimiter=self.options['delimiter'],
                            lineterminator=self.options['lineterminator']**,escapechar='\n'**)

(the --escape parameter did not help in my case)

would be great, if you could let us specify the escape character for line feeds as a parameter!

anyway, thanks for the great python script - we use it every day in production imports

I agree on the escape character parameter. Also, I am having this error because I use option QUOTE='none' on a file containing double quotes values (for inches, for seconds, or just for quoting). sample file for testing purposes here.
Test_doublequotes.xlsx

Command used
xlsx2csv -c windows-1252 -d ";" -f "%d-%m-%Y" -n "Feuil1" -q "none" "Test_doublequotes.xlsx" "Test_doublequotes.csv"
So, it could be good it the output would not have any double quote added as quotechar ( but i see this one could not be empty anymore)
I have changed line 295 in order to never have double quote as quotechar (still allowed for me)

            writer = csv.writer(outfile, quoting=self.options['quoting'], delimiter=self.options['delimiter'],
                                lineterminator=self.options['lineterminator'],quotechar='')

by the way thanks a lot for the xslx2csv, it helps saving a lot of time!!