Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi there,
I was just wondering if anyone else has had this problem:
We create a CSV file with a whole bunch of stock codes. Many of these stock codes start with the number "0" eg 01SD4. when the csv file is read into excel, the entries beginning with 0 are truncated. eg 01SD4 -> 1SD4. Looking at the documentation, it seemed that if we put a ' at the beginning of the code (eg '01SD4) it should read it as text and disply correctly. HOWEVER when we read the new csv file in (the one with the ' before all the entries beginning with 0) excel will disply the whole entry still, including the ' .... the funny thing is, if you edit the entry, dont change anything and hit enter, the ' goes away...is there any way to read in the csv file and display properly without the ' but with the 0 straight away without goign through all 3000 lines and changing the ones with ' ???
Instead of just opening the csv file in Excel, create a new Worksheet. Then:
Data
Get External Data
Import Text File
Show All Files
Browse to the csv file
Next
Select Comma Only
Text Qualifier - None
Next
Highlight all data
Column Data Format
Text (as opposed to the default General)
Finish
OKThat's it...
Report Offensive Follow Up For Removal
Hi. Thanks for your reply, but it still dosnt work. After doing all that it still displays the codes with the ' infront of them. The only way to get rid of them seems to be to edit the cell, change nothing and hit enter.
Report Offensive Follow Up For Removal
If your csv file has the apostrophe in the "field", then of course the spreadsheet will have them. I guess I misunderstood. I based my answer on your original statement "Many of these stock codes start with the number "0" eg 01SD4. when the csv file is read into excel, the entries beginning with 0 are truncated. eg 01SD4 -> 1SD4". I assumed you were going to import your original csv file that didn't contain the edited information.
Report Offensive Follow Up For Removal
ah ok. Thatll go.
Thing is the people that use the csv want to just click it and it to be ready for them to use... I might have to make a macro... (these are users that cant get their heads around "run the file" or other similar simple statements, so trying to get them to do the whol;e data impot thing will probably be a stretch.Thanks for you efforts tho! Much appreciated, this is why I come to this site for answers.
CHEEEEEERS!
Report Offensive Follow Up For Removal
If all of the codes contain 5 characters then just format that column's cells using the Custom or Special format and make it ##### so it will be 5 characters long.
(I don't have Excel on this machine so I can not verify if the "#" is the correct operator or not but it says the correct info under Help)HTH
Bryan
Report Offensive Follow Up For Removal
Ok, I went to my other PC.
Use 00000 (5 zeros) unless the .csv does contain the ' when imported. Or during the import do not assign the ' to the formatting.Bryan
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |