How To Export Excel Spreadsheet To A Fixed-Width Text File

The easy way is to Save As to a Formatted Text file (Space Delimited)(*.prn).

kjc Excel Save As Formatted Text File - How To Export Excel Spreadsheet To A Fixed-Width Text File

But you will be struggled to find out that it’s really hard to precisely specify the fixed-width, almost impossible to use to export the data into a perfect space aligned text file.

What I am luck to find out is this with VBA. It’s a far more flexible solution that lets you export a spreadsheet to a perfectly lined up text file. The author also posted a template for you to download and use. If you know a little bit VBA, you can even change the code to work you better.

Basically, the first row in the template defines the width of each column. All you need to do is paste the data into the template, highlight them, and click Export button to save the fixed-width text file in the same directory as the template is saved.

Leave a Reply

Your email address will not be published.