I want to read a CSV file, change it, and save it again. In the CSV file, I have a column with numbers. They are floats, but the value is “integer-like”: 1.0, 2.0, 0.0, etc.
When I open the CSV file, Libreoffice converts this floats to integers. When I save it back to CSV, integers are saved. So the file is different, even if I don’t change anything.
My problem is, I want to inject this file to a database (InfluxDB), and in my case the database wants floats. So after open/save in Libreoffice, I can’t inject the file anymore.
My question: Is there a way to prevent this automatic convertion? Is it possible to read and write a CSV file “as is”?
Thanks in advance!
UPDATE: How to reproduce:
- Create a test.csv file with a text editor, like:
header_col1 1.0 2.0 3.0
- open it with Libroffice Calc
- Save it as test2.csv
- Open test2.csv with a text editor. It will look like this:
header_col1 1 2 3