ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel - CSV Format and column width (https://www.excelbanter.com/excel-discussion-misc-queries/29564-excel-csv-format-column-width.html)

[email protected]

Excel - CSV Format and column width
 

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.


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.

wrote:

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.


--

Dave Peterson

[email protected]


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.

Dave Peterson wrote:
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.



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?



wrote:

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.

Dave Peterson wrote:
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.


--

Dave Peterson

[email protected]

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

Dave Peterson wrote:
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?



wrote:

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.



Dave Peterson

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

wrote:

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

Dave Peterson wrote:
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?



wrote:

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.


--

Dave Peterson

[email protected]


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.

Dave Peterson wrote:
So maybe just widening the columns after you open the .csv file in excel would
be sufficient?



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.

wrote:

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.

Dave Peterson wrote:
So maybe just widening the columns after you open the .csv file in excel would
be sufficient?


--

Dave Peterson


All times are GMT +1. The time now is 07:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com