How do I create a fixed width text file?

Craigoh1 picture Craigoh1 · Jan 30, 2014 · Viewed 42.3k times · Source

I have a fixed width text file that I needed to edit about 200 rows of. Importing into excel is easy but when I have completed my edits and try to save the file as a space-delimited or text file all the spacing goes out of whack, i.e the first field in excel is padded out to 6 characters but when I save the file as space-delimited or text it then turns that field into 8 characters.

Please note that I'm using a LEFT(text&REPT(" ", 30)30) formula to get the required padding which works very nicely. However I can't seem to save the file with the correct number of spaces. I have also just tried copying and pasting into a notepad file but this seems to just create more unwanted spaces etc.

How do I create a fixed width file when I have all the data I need and the field length requirements?? Has anyone had this trouble before? Thanks in advance.

Answer

Kenneth Hampton picture Kenneth Hampton · Jan 30, 2014

I agree with Gary's Student. Just go to: Save As -> Formatted Text (Space Delimited) (.prn)*.This will bring almost same functionality as one you have in Excel.

For more information you may refer to: https://superuser.com/questions/100433/export-an-excel-spreadsheet-to-fixed-width-text-file