开发者

Issue in exporting data to CSV

I am doing export of开发者_C百科 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.


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


Change column Data Format when importing the text change it to Text


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜