If you have Excel, you can save it in CSV format normally by selecting CSV format in "Save As", but there are restrictions on output such as not being able to set quotes. So how do you meet the conditions that you want to convert and customize on the command line? Use xlsx2csv.
https://github.com/dilshod/xlsx2csv
You can use it by inserting python and executing xlsx2csv.py as described in the README, but the output is basically without quotes. What should i do?
Line 114 is hardcoded with * csv.QUOTE_MINIMAL *.
writer = csv.writer(outfile, quoting=csv.QUOTE_MINIMAL, delimiter=delimiter)
If you change this to * csv.QUOTE_ALL *, all fields will be output with quotes. The explanation of other options will be thrown in Description of csv module.
writer = csv.writer(outfile, quoting=csv.QUOTE_ALL, delimiter=delimiter)
I searched for a similar article, but I didn't, so I wrote it down.
Recommended Posts