Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Excel to ASCII Fixed Width

Status
Not open for further replies.

misssaraliz

Technical User
Feb 14, 2002
12
0
0
US
I need to know how to convert an Excel file to fixed width ASCII. Is this just a matter of saving as a different file type? Does it involve changing the type of cells (ie. general)? I'll have to remove all the column headers, right and then produce a file layout? Please let me know the steps to get the document into an ASCII fixed width. I would really appreciate it.

Thanks,

Sara
 
You'll need to save as .TXT
You will also, as you rightly say, need to get rid of any headers

Also, you will need to set the column widths carefully.

For a 6 character field, set the column width in excel to 6 and make sure there are no fields which exceed this. You'll have to do that for all columns with data

HTH Rgds
Geoff

Veni, vidi, volo in domum redire
 
I am assuming that by the term "fixed-width ASCII" you are describing a file where all the records have the same length and the columns are aligned.

When I tried xlbo's suggestion (use .txt) in Excel 97, I got tab-delimited and varying record lengths.

When I tried "Formatted Text (Space delimited)(*.prn) I was able to get fixed length lines as long as the last one on the right was numeric (and not left- or center- justified). Strings in the right-hand column came out ragged and the record lengths were not consistent.

As xlbo says, the column widths need to be set verrrry carefully.

If this is a one-time data conversion, the .prn technique is ok, but for consistency and repeatability, I would look for another way.

Using a .csv file and formatting it with another program would be my first choice, but it depends on exactly what is going to be done with the output file, and you didn't tell us that. Perhaps the next step could use .csv format as its input?
 
You could import the files into Access and then export them as a text file. After you import the file right click and choose export and then choose a text extension. At the first step of the export wizard choose fixed length and choose the advance choice. Then you can set the field lengths you wish and save the format for the next time. You will then have a fixed length file to import to your data base. If your data base has specific field lengths be aware and set your field lengths accordingly..

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top