没有指数数字的 CSV 文件创建
如何解决将值插入 csv 文件时发生的指数转换。我有一个创建 csv 文件然后开始在其中输入行的过程。行中的其中一个字段插入与此类似的值:
123,45,45,466,6656,23423,2455,234,2454
这些只是我需要在 csv 文件中保留的一串 id,以便将它们导入另一个程序需要此字段中以逗号分隔的多个值。
当然,当我打开 Excel 并查看此 csv 时,它会给出如下内容: 123,45,45,466,6656,000,000,000,000
因此最后几个值对导入过程没有任何意义,并且会失败。
我的问题是如何写入 csv 文件并绕过将我的值转换为指数数字以及保留逗号分隔的数值(如上面所示)?
提前致谢 比利
How do you get around the exponential conversion that takes place when inserting a value into a csv file. I have a process that creates a csv file and then starts entering rows into it. One of those fields inside a row inserts a value similar to this:
123,45,45,466,6656,23423,2455,234,2454
These are just a string of id's i need to preserve on the csv file in order to import them into another program that expects a comma separated number of values in this field.
Of course when i open excel and look at this csv it gives me something like this:
123,45,45,466,6656,000,000,000,000
so those last few values mean nothing to the import process and it fails.
My question is how do i write to a csv file and get around my values being converted to exponential numbers as well as preserving the comma separated number values like above?
Thanks in advance
Billy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在它们周围加上引号
“123”,“45”,“45”,“466”,“6656”,“23423”,“2455”,“234”,“2454”
Put quotes around them
"123","45","45","466","6656","23423","2455","234","2454"
为了解决这个问题,我在 MS Excel 2007 中使用了以下步骤:
注意:窗口的下半部分将预览数据导入的方式。
In order to get around this issue i used the following steps in MS Excel 2007:
Note: The bottom half of the window will preview the way the data is to be imported.
使用数据时将值放在单引号中
例如:
试试这个
它将完美地存储数据
place the value in single quotes while using data
Eg:
Try this
It will store the data perfectly