Excel - CSV Format and column width

K

kejoseph

I am using CSV format in Excel and need to be able to define different
column widths. Is there no way to do this ?

If there isnt a way, is there any other text file format I can use to
store this information in ?

Kevin.
 
D

Dave Peterson

Comma separated values files usually contain fields that vary in length (between
records). The comma is the delimited that tells the program reading the file
what goes in each field.

If you want fixed width fields (like for a mainframe application????), you may
be able to just adjust the columnwidths and do File|saveAs (and choose
"formatted text (space delimited) (*.prn)" in the "save as type".

Saving a .csv file with fixed length fields seems kind of unusual to me.
 
K

kejoseph

CSV file - Thats just what I thought, but its not the way Excel treats
it. No matter where the comma is placed, all the columns are of equal
length.
 
D

Dave Peterson

Is the data in each record (for the same field) always the same length?

If you open the .csv file using Notepad, does it look ok there?
 
K

kejoseph

Thats correct DAve. In Excel its always the same length but in Notepad
it shows just fine.
 
D

Dave Peterson

So maybe just widening the columns after you open the .csv file in excel would
be sufficient?
 
K

kejoseph

Definitely - my whole point of performing this exercise is to
automating sending a report - which is currently manual - via a CSV
file. If I have to re-format the file and send it to everyone, it
defeats the main purpose of this exercise.

Thanks for all your help.
Kevin.
 
D

Dave Peterson

You may want to share the file as a .txt file.

And give them a workbook that contains a macro that imports that .txt file. You
could add headers/filters/page layout/pivottables/charts and graphs and other
stuff.

Send out the .txt file whenever you want. But include instructions to open the
workbook that contains the macro and run that macro to import the data.

If you add enough nice stuff to the macro (not just formatting), the end users
may even like it better.
 
Top