CSV file decimal value issue

I have a csv file with multiple columns. Some columns have numeric data with decimal having 2 to 10 decimal accuracy. When reading this file from ADODB record using VBA some column decimal values are getting picked correct but for some its only taking number (without decimal).

Example:
Column 1 value = 26.0123456789 (value can vary)
Column 2 value = 26.0123456789 (value can vary)

In the record object the value for column 1 is coming as 26.0123456789 but for column 2 is coming as 26

Using connection string as:
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Directory_Path & ";" & "Extended Properties=""Text;FMT=Delimited(,)"";"

2 answers

Have you tried putting a schema.ini file in the folder.

It can contain specifications about your data.

[Data.csv]
ColNameHeader=true
MaxScanRows=0

MaxScanRows with value 0 in this case would cause the datatype guessing to scan all rows in the file.

Hi John

Thanks for the reply. Yes I tried that yesterday and it worked like a charm. I went busy with other stuff so could not update here.

Thanks a lot for replying.