Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: File Formats that Include Field Formats.

File Formats that Include Field Formats

by Allen Wyatt
(last updated December 26, 2015)

3

Wolfgang often imports CSV files that are created by other programs. When importing, he needs to specify how Excel should treat the incoming data. This causes Wolfgang to wonder if there is a file format that Excel can import that has field formats embedded so that he doesn't have to do any manual work on import.

The short answer is no, there isn't such a format. Technically you can create an XML-formatted file that uses the format of Office, and it can specify what the field formats should be. Such a file consists of only text (like a traditional CSV file) and includes specifiers about how the data should be formatted. (Complete details on how such an XML file should be structured is beyond the scope of this tip.)

Such an endeavor is undeniably daunting to many people, so you could also simply import your CSV file with no formatting applied, and then use the macro recorder to record how you manually format the freshly imported data. This macro could then be executed every time you import another file that uses the same sort of data as the first CSV file you imported.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11602) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: File Formats that Include Field Formats.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Modifying Default Year for Dates

When entering dates into a worksheet, you may want the dates to default to last year instead of this year. Here's a way ...

Discover More

Getting Rid of Empty Rows after Importing

Import data into a worksheet (or paste it there) and you may find that you end up with a group of blank cells you need to ...

Discover More

Finding Related Words

One part of the grammar tools provided with Word is a thesaurus that helps you find all sorts of word variations. One ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Loading Unwanted Files at Startup

Imagine how painful it would be if every time you started Excel it tried to load all the files in your root directory? ...

Discover More

Creating a Dated Backup File

As you are developing your workbooks, you might want a way to automatically create backup files that include a date and ...

Discover More

Accessing Old Excel Data

If you have some legacy data stored in very old spreadsheet files, you may be wondering how to get that data into an ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four more than 2?

2016-01-04 12:21:55

Steve Adams

Anne's suggestion works very well for me as well.

But for new files being imported for the first time, I have had some success in change the file extension of the CSV file to .TXT

Then open Excel first and then use the file open commands to locate the .TXT file (you will have to change the file type drop down from "All Excel Files..." to "Text Files..."

The Text Import Wizard will start automatically when opening a .TXT file.

On Step 1 select "Delimited"
If your file has page header text, you may need to select a starting row for the import (either your column header row if one exists or the first data row).

On Step 2 Select "Comma" for the delimiter (assuming you did start with a .CSV file).

On step 3 you can click on the various columns and identify some basic formats (General, Text, or Date) or to skip a column. If you have an identifying number that exceeds Excel's number place values (15 digits), select text for that column to prevent truncation (or to preserve leading zeros). Also, dates sometimes come across as text if you don't select the Date format.


2015-12-28 11:00:06

Anne

Further to my comment, I should specify to copy and paste VALUES, of course.


2015-12-28 10:11:35

Anne

I spend my days working with CSV and SAP files. I use them to create reports or gather information for reports. What I've done is create an excel spreadsheet formatted to my specifications, using the CSV data, initially. (I often use Excel Tables, as they maintain the formatting even when data is added below the last row.) I then copy and paste the data from the CSV file to the formatted spreadsheet - omitting the column headers as they would already exist in the formatting spreadsheet from previous reports. The CSV data automatically take on the formatting of the existing spreadsheet. For instance, the SAP file I use repeatedly have lots of numbers with leading zeros - like so - 00000000240. When I drop this into my formatted spreadsheet, it appears at 240, with no additional manipulation needed. Magic!


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.