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

Printing Style Sheets

Want to see what styles are defined in your document? Let Word print out a simplistic style sheet for you.

Discover More

Working with Multiple Printers

Word does not keep printer information associated with documents. You can define a macro for each printer you use and put ...

Discover More

Changing Compression Print Resolution

The resolution at which Word compresses graphics in a document may be bothersome. If it is, your options are very ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Sorting Files

The Open dialog box allows you to sort the files it presents to you. How you do the sorting depends on the version of ...

Discover More

Jumping Around Folders

When you open a workbook in Excel, the Open dialog box always starts within the folder in which you were last working. ...

Discover More

Pulling Filenames into a Worksheet

You can use Excel for all types of data processing. You may want to work with filenames in a worksheet, but the first ...

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 six more than 7?

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.