M
MyndPhlyp
I'm having a little "fun" creating a CSV file from an ASP page for use with
Excel and hope someone here knows of a trick that doesn't involve user
intervention.
I am familiar with the format of CSV files - strings containing a comma must
be enclosed with double quotes, otherwise just separate all the columns with
a comma.
But ...
Excel tries to be smart about things. If a string, quoted or unquoted,
contains leading spaces and/or trailing spaces and/or leading zeros and is
otherwise numeric (number groupings, decimal points, positive/negative sign,
currency sign, and the characters 0-9) it converts the value to numeric.
For example, the CSV may contain:
000823
The resulting cell will be numeric containing:
823
I know the trick when manually entering a value in a cell that is numeric
but you want treated as a string. Preceed the value with a single quote.
For example, manually entering the cell value:
'000823
The resulting cell will be text containing:
000823
But ...
Doing so in a CSV causes Excel to use that preceeding single quote as part
of the (now definitely non-numeric) string.
Is there a way (or another easily generated file format) to get these
seemingly numeric values to be treated as a string by Excel without
resorting to user intervention (such as the process of importing a text file
where the user is prompted for column placements, delimiters and value
type)?
Excel and hope someone here knows of a trick that doesn't involve user
intervention.
I am familiar with the format of CSV files - strings containing a comma must
be enclosed with double quotes, otherwise just separate all the columns with
a comma.
But ...
Excel tries to be smart about things. If a string, quoted or unquoted,
contains leading spaces and/or trailing spaces and/or leading zeros and is
otherwise numeric (number groupings, decimal points, positive/negative sign,
currency sign, and the characters 0-9) it converts the value to numeric.
For example, the CSV may contain:
000823
The resulting cell will be numeric containing:
823
I know the trick when manually entering a value in a cell that is numeric
but you want treated as a string. Preceed the value with a single quote.
For example, manually entering the cell value:
'000823
The resulting cell will be text containing:
000823
But ...
Doing so in a CSV causes Excel to use that preceeding single quote as part
of the (now definitely non-numeric) string.
Is there a way (or another easily generated file format) to get these
seemingly numeric values to be treated as a string by Excel without
resorting to user intervention (such as the process of importing a text file
where the user is prompted for column placements, delimiters and value
type)?