Reputation: 1700
I am doing export of data from database to Excel. After exporting when opening the csv file, the excel application is autoformating the values in excel.
One my cell contained the value -A1177, but it got converted to zero.
Can any one let me know is there any solution to avoid this or switch off this autoformat in excel.
thanks.
Upvotes: 0
Views: 350
Reputation: 4683
Change column Data Format when importing the text change it to Text
Upvotes: 1
Reputation: 32780
Insert a '
at the start of any formula in Excel
and it will be considered a string
.
So if possible, check when generating the CSV file if the first char in a given field can be understood as an Excel formula "opener" (off my mind {=, -, +}
) and prepend a '
.
You can do it for every field, but its only strictly necessary if the text can be misunderstood as a formula.
Upvotes: 0
Reputation: 61609
The easiest way to do it, is to simply wrap the value in quotes, e.g. asdasd,"-A1177",11/03/1984
in your CSV file. You can also change the format of the column to `Text'.
Otherwise, check out this excellent Stack Overflow Question and Answer
Upvotes: 2