Hi,

I have imported a csv file but for some reason in some values the data after . is missing
for e.g.
If my value in csv is 0.5 it displays 0. and 5 went missing
but in my csv file i have value as 0.5
I don't what step i am missing on import.

Recommended Answers

All 9 Replies

what did you import the csv file to?

phpmyadmin and kept my first row as column of the table

Did you specify column types or let it auto generate? Can you post the table schema?

Please specify where did you imported the CSV.

NOTE: If you have imported in MySQL, check your datatypes, if it's INT it will chunk it, you should use float, double or decimal in this case.

I have imported in MySQL

I had let it auto generate...so it gives datatypes as varchar(2)

Then i changed the datatype to float (11,4)
On again importing csv the datatype is now float but the data which was 0. it now shows 0.0000
Still 5 is missing from the data

Please post the table scheme, maybe it's a problem of the ID and you are trying to import the data in the wrong column.

You can try the HeidiSQL which gives you feedback upon each error.

Member Avatar for diafol

On again importing csv the datatype is now float but the data which was 0. it now shows 0.0000

Well it will as the 5 wasn't stored in the first place. If you run the csv import again, it should work.

I agree with diafol, if you truncate the table and keep the modified schema, then re-import the file into that table it should work.

I tried running csv import again but didn't helped.
I was saving my .ods file to .csv and don't know what was wrong with it but it always show me an error
Invalid column count in CSV input on line 1 Error.
I checked my column count and it was correct.
Then i tried Google spreadsheet and saved it as .csv and there it gets imported properly into database.
Solved but wasn't able to figure out the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.