lunedì 20 aprile 2020

How to create a fixed-position text file from a csv/xls file

Creating a fixed position text file from a spreadsheet is a very common necessity working with Tax and Accounting or ERP software, right?

And you need some basic programming skills for doing that, right?

Well, not exactly.

Suppose you need to create a text file as this:

position 1:            A (a constant)
position 2-4:         blank
position 5-13        a 9 digit numeric code
position 14-17      blank
position 19-21      an ordinal number 0001, 0002, etc.

So you have a spreadsheet like this:



What you need to do is just to set the length of each coloumn with the appropriate whole number:

A = 1
B = 3
C = 9
D = 4
E = 4

At this point you save the file as a .prn file. In Excel this is a formatted text (space delimited) file.
If you want, you change the extension into .txt and the magic is done!


Nessun commento:

Posta un commento