akohan
asked on
Writing numbers in text file (csv, excel)
Hello,
I'm writing some data into a text file as *.csv and one of the columns is credit card number. However, when it is opened in Excel its values is converted to scientific notation such as 4.54111E+15 (of course that is due to the format Excel assigns to cell containing this value) however, when I open it notepad or any ascii editor the value is normal.
How can I make it such that when Excel reads it still reads it as a normal number or string?
I tried:
sb.Append(String.Format("\ "{0}\"", sCcNum.ToString() )
yet it still Excel shows it with scientific notation.
Thanks.
I'm writing some data into a text file as *.csv and one of the columns is credit card number. However, when it is opened in Excel its values is converted to scientific notation such as 4.54111E+15 (of course that is due to the format Excel assigns to cell containing this value) however, when I open it notepad or any ascii editor the value is normal.
How can I make it such that when Excel reads it still reads it as a normal number or string?
I tried:
sb.Append(String.Format("\
yet it still Excel shows it with scientific notation.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
The best way for that was ="1234567890123". The = makes the cell a formula, and the quotation marks make the enclosed value an Excel string literal. This will display all the digits, even beyond Excel's numeric precision limit, but the cell (generally) won't be able to be used directly in numeric calculations.
The best way for that was ="1234567890123". The = makes the cell a formula, and the quotation marks make the enclosed value an Excel string literal. This will display all the digits, even beyond Excel's numeric precision limit, but the cell (generally) won't be able to be used directly in numeric calculations.
ASKER
Thanks to all.
ASKER
This helped.
Thank you
Thank you
sb.Append(String.Format("=