Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent excel from truncating numbers in a CSV file?

Tags:

csv

excel

The first few lines of my CSV file look like this (when viewed from Notepad++):

Trace,Original Serial Number,New Serial number 0000073800000000097612345678901234567890,0054,0001

When I open this file in excel, I get this:

enter image description here

For some reason, excel is truncating the serial numbers and the trace number. I have tried changing the format to Text but that still doesn't work, as excel only sees the value up to the 6:

7.38000000000976E+34

If I change it to Number:

73800000000097600000000000000000000.00

What can I do? I only have 60 lines, so if I have to start over and some how recopy the text into excel I will, but I'm afraid saving it will change the format once again.

like image 963
AdamMc331 Avatar asked Jan 06 '15 14:01

AdamMc331


2 Answers

Excel is trying to "help" you by formatting the input values. To avoid this, do not double-click the file to open it. Instead, open the Data tab and in the Get External Data section, click on From Text

Then tell the Import Wizard that the fields are Text:

like image 114
Gary's Student Avatar answered Oct 15 '22 18:10

Gary's Student


You shouldn't need to start over or alter the existing CSV. The fastest way might be to use Excel's text import wizard. In the data tab under Get External Data click From Text and select your CSV file.

The wizard that appears will let you tell Excel the data type of each "column" and you can tell it to use text for your barcode.

like image 28
Jobbo Avatar answered Oct 15 '22 19:10

Jobbo