停止Excel自动将某些文本值转换为日期 [英] Stop Excel from automatically converting certain text values to dates
问题描述
有人碰巧知道是否有一个令牌,我可以添加到某个字段的csv,所以Excel不会尝试将其转换为日期?
Does anyone happen to know if there is a token I can add to my csv for a certain field so Excel doesn't try to convert it to a date?
我试图从我的应用程序写一个.csv文件,其中一个值看起来像一个日期,Excel自动将它从文本转换为日期。我已经尝试将所有的文本字段(包括看起来像一个日期)在双引号内,但是没有效果。
I'm trying to write a .csv file from my application and one of the values happens to look enough like a date that Excel is automatically converting it from text to a date. I've tried putting all of my text fields (including the one that looks like a date) within double quotes, but that has no effect.
推荐答案
我发现在双引号之前加上一个=将会完成你想要的。它强制数据为文本。
I have found that putting an '=' before the double quotes will accomplish what you want. It forces the data to be text.
例如。 =2008-10-03,=更多文字
eg. ="2008-10-03",="more text"
EDIT(根据其他文章) =http://stackoverflow.com/a/4412775/684229> Jeffiekins提到的Excel 2007错误应该使用 Andrew建议的解决方案:=2008-10-03
EDIT (according to other posts): because of the Excel 2007 bug noted by Jeffiekins one should use the solution proposed by Andrew: "=""2008-10-03"""
这篇关于停止Excel自动将某些文本值转换为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!