Excel CSV - 数字单元格格式 [英] Excel CSV - Number cell format

查看:32
本文介绍了Excel CSV - 数字单元格格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将报告生成为 CSV 文件.当我尝试在 Excel 中打开文件时,它会根据单元格的内容对数据类型做出假设,并相应地重新格式化.

I produce a report as an CSV file. When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly.

例如,如果 CSV 文件包含

For example, if the CSV file contains

...,005,...

然后Excel显示为5.有没有办法覆盖它并显示 005?

Then Excel shows it as 5. Is there a way to override this and display 005?

我更愿意对文件本身做一些事情,这样用户只需双击 CSV 文件即可打开它.

I would prefer to do something to the file itself, so that the user could just double-click on the CSV file to open it.

我使用 Excel 2003.

I use Excel 2003.

推荐答案

在打开 .csv 文件时,没有一种简单的方法来控制 Excel 应用的格式.不过,下面列出的三种方法可能会有所帮助.

There isn’t an easy way to control the formatting Excel applies when opening a .csv file. However listed below are three approaches that might help.

我的偏好是第一个选项.

My preference is the first option.

选项 1 – 更改文件中的数据

您可以按如下方式更改 .csv 文件中的数据...,="005",...这将在 Excel 中显示为 ...,005,...

You could change the data in the .csv file as follows ...,="005",... This will be displayed in Excel as ...,005,...

Excel 会将数据保留为公式,但复制列并使用粘贴特殊值将删除公式但保留格式

Excel will have kept the data as a formula, but copying the column and using paste special values will get rid of the formula but retain the formatting

选项 2 – 格式化数据

如果这只是一个格式问题,并且该列中的所有数据的长度都是三位数.然后在 Excel 中打开数据,然后使用此自定义格式 000

If it is simply a format issue and all your data in that column has a three digits length. Then open the data in Excel and then format the column containing the data with this custom format 000

选项 3 – 将文件扩展名更改为 .dif(数据交换格式)

Option 3 – Change the file extension to .dif (Data interchange format)

更改文件扩展名并使用文件导入向导来控制格式.双击时,Excel 会自动打开扩展名为 .dif 的文件.

Change the file extension and use the file import wizard to control the formats. Files with a .dif extension are automatically opened by Excel when double clicked on.

循序渐进:

  • 将文件扩展名从 .csv 更改为 .dif
  • 双击文件以在 Excel 中打开它.
  • 将启动文件导入向导".
  • 将文件类型"设置为分隔",然后单击下一步"按钮.
  • 在分隔符下,勾选逗号"并点击下一步"按钮.
  • 点击显示的每一列数据,然后选择列数据格式".值为005"的列的格式应为文本".
  • 单击完成按钮,Excel 将使用您指定的格式打开文件.

这篇关于Excel CSV - 数字单元格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆