• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

CSV file to fixed format text file

siva seethiraju

New Member
Hi,

I have a csv file. I am planning to convert it into fixed format text file. I have tried using the option of save as with Formatted Text(Space delimited) (*.prn). But somehow i didn't get the data in fixed format. Could you please let me know what are the option i have to achieve it. It would be great if i can get the response quickly.

Thanks,
Siva
 
Siva,

The *.prn format uses the column width to determine the number of characters for the fixed width format. I have attached a very simple example (both *.xlsx and *.prn files) to illustrate this for the first 60 characters of a fixed format.

I hope that helps.

Regards,
Ken

Note: I had to add a .txt to the prn file.
 

Attachments

  • FixedWidth_to_60.xlsx
    8.4 KB · Views: 2
  • FixedWidth_to_60.prn.txt
    124 bytes · Views: 3
Siva,

The *.prn format uses the column width to determine the number of characters for the fixed width format. I have attached a very simple example (both *.xlsx and *.prn files) to illustrate this for the first 60 characters of a fixed format.

I hope that helps.

Regards,
Ken

Note: I had to add a .txt to the prn file.
Ken, Thank you for the reply. But sorry to say, i didn't get what is the command or script to use to convert into .prn file. The one provided with excel is not giving me the desired output.

Thanks,
Siva
 
As showed by KenIJ, it depends on data …
With right data, prn Excel format performs output as expected !

As we can't see anything from your source data and your desired output

voyante-2943.gif

as you did not describe source data neither output format,
all I can advice is to fill cells with same length by column
either by code or formula (in a helper spaces column) …

For example as here it's the Excel formulas forum,
if first column has to be 10 characters long,
insert a new column in B and enter this formula in B1 :

=REPT(" ",10-LEN(LEFT(A1,10)))
Copy down until end of first column. Redo the same for other columns …
 
Mark, Thank you for the reply. I would try to upload or mention about source and ressult i am looking for today to have clear picture of what i am expecting. Thank you once again for your quick reply.
 
Back
Top