Excel CSV import treating quoted strings of numbers as numeric values, not strings

Posted by MichaelOryl on Super User See other posts from Super User or by MichaelOryl
Published on 2013-03-19T16:21:08Z Indexed on 2013/11/05 21:58 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

I've got a web application that is exporting its data to a CSV file. Here's one example row of the CSV file in question:

28,"65154",02/21/2013 00:00,"false","0316295","8316012,8315844","MALE"

Since I can't post an image, I'll have to explain the results in Excel. The "0316295" field gets turned into a number and the leading 0 goes away. The "8316012,8315844" gets interpreted as one single number: 83,160,128,315,844. That is, most obviously, not the intended result.

I've seen people recommend a leading single quote for such cases, but that doesn't really work either.

28,"65154",02/21/2013 00:00,"false","'0316295","'8316012,8315844","MALE"

The single quote is visible at all times in the cell in Excel, though if I enter a number with a leading single quote myself, it shows just the intended string and not the single quote with the string.

Importing is not the same as typing, it seems.

Anybody have a solution here?

© Super User or respective owner

Related posts about microsoft-excel

Related posts about csv