Reputation: 159
I am reading a column number from csv where the number is 123456791234567 however due to format it gets converted to number="1.23457E+14" in the csv file.
is there any way where we can change it to original string using c# ? I am trying with below code :
decimal number = Decimal.Parse(number,System.Globalization.NumberStyles.Any);
but the number i am getting is 123457000000000M and the actual number is 123456791234567
any idea on this?
Upvotes: 0
Views: 849
Reputation: 4394
If I understand correctly, excel is converting 123456791234567 to 1.23457E+14. In that case, you just need to format the excel cell (or potentially the column) containing the value to string, before you set the value.
If the C# program opens the csv to find the value to be 1.23457E+14, then there is no way for you to convert it back to 123456791234567, since the precision is already lost - unless of course the same value exists (or can be recreated) in other cells (columns)
Upvotes: 1