Formatting csv files in Excel

旧城冷巷雨未停 提交于 2019-12-23 15:52:35

问题


Win XP, Excel 2007

I know there are various other posts on csv formatting but couldn't quite find what i needed.

Some of our data is held off site by another company and they send us a csv file every morning with the previous days data.

The problem is this data has come from web input forms that may have drop-down lists.

For example there may be a drop down list of Number of Employees with options like 1-10, 11-25, 26-50 etc

When we open the csv file in Excel certain options like 1-10 has been turned into Oct-01 date format which we do not want.

Is there an easy way to change these back OR reformat the cells and do a find...replace? (This didn't seem to work terribly well as it kept reverting back to the date)

Indeed is there a better way of opening the csv file to keep the formatting intact? and save us doing lots of find...replaces.

Ultimately we will need to open the csv in Excel though.

Grateful for any hints


回答1:


Isn't that SO annoying? Here's how I deal with this issue:

When you open the CSV file in Excel, you should get a dialog with parsing options. First you select delimited or fixed then you get a screen that previews the data parsing.

It's easy to miss, but in the upper right corner of the dialog box there's an option to set a specific data format for each column. Select the column you want to protect and set the format to text. (This keeps Excel from dropping the leading zeros in ZIP codes for New England too!)

Once you get it into Excel, you can do a vlookup or replace to reset the values to your own codes.

Hope this helps. Good luck.



来源:https://stackoverflow.com/questions/5788465/formatting-csv-files-in-excel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!