Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bypass excel csv formula conversion on fields starting with + or -

Tags:

I have a csv file with contents:

"x","y","-z" 

When I import it I get:

alt text

How can I bypass this conversion?

Update

If you try:

   "x","y",="-z,a" 

The ",a" is not imported.

If you put a space in front:

   "x","y",=" -z" 

or

   "x","y"," -z" 

it will work fine

like image 865
Ηλίας Avatar asked Dec 14 '10 11:12

Ηλίας


People also ask

How do I stop Excel from auto formatting my CSV file?

In the "Data preview", scroll to the far right, then hold shift and click on the last column (this will select all columns). Now in the "Column data format" select the radio button "Text", then click "Finish".


2 Answers

Prefix the values with equals signs

="x",="y",="-z" 
like image 137
Seidr Avatar answered Sep 19 '22 18:09

Seidr


Your problem is that by using the CSV extension, you are forcing excel to interpret the file using its very strict CSV conventions, and this will often go against whatever it is you're trying to do unless the CSV file was originally created by Excel. Your easiest, and most reliable method of importing this CSV file, is to rename it to a TXT file, and then use the import function in excel to coerce columns in exactly the way you want.

like image 25
Alain Avatar answered Sep 17 '22 18:09

Alain