Disable conversion from text to number from .csv file

S

Steve Forest

I need to generate a .csv file that will not have columns automatically
converted to numbers when they are in fact text. For example, I have a CUSIP
"6471989E2" which is converted to 647198900 by Excel automatically. I have
tried surrounding field in double quotes but that has no effect. Single
quotes avoid the conversion, but the quotes appear in the spreadsheet, also
undesirable.

Note: I must have a 'double-click' solution. The file must open correctly on
a double-click without any user intervention or special importing.
For example, is there a non-printable escape character that can be added to
the field that would tell Excel that it must treat the field as text?

Thanks,
 
G

Gary''s Student

The combination of naming the file .csv and double-clicking the icon tells
Excel to perform conversions on the data. There are at least 4 ways to avoid
conversion:

1. name the file something.txt When opened, Excel will bring up the Import
Wizard to allow you define the column as Text

2. Place an apostrophe (single quote) in from of the value. No conversion
will be performed

3. rather than double-clicking, first open Excel and then use:

Data > Import External Data > Import Data...

which also brings up the Import Wizard


4. Open the file with VBA



Take your pick.
 
S

Steve Forest

Unfortunately none of these meet my requirements:

1. I am trying to automate - naming the file to .txt means the user has to
do this conversion manually.
2. Adding the single quote makes the quote visible in the spreadsheet - not
acceptable.
3. Not automatic
4. Definitely not automatic.

Let me restate the issue:

I need to generate a file that Excel will not mangle by doing unwanted
conversions and can be opened by double-click without any user intervention.

Since the single-quote does not work, is there a non-printable escape that
will?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top