Search code examples
exceltext-filesfixed-widthexport-to-text

How do I create a fixed width text file?


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.


Solution

  • I found that the best way to do this was to use Access and save as a text file and then you can set your own field width and export. excellent!