ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Export file to CSV delimited with fixed field length (https://www.excelbanter.com/excel-discussion-misc-queries/28215-export-file-csv-delimited-fixed-field-length.html)

Plucky Duck

Export file to CSV delimited with fixed field length
 
Hi there!

I have an Excel file with a series of fields, each in one column.

What I need to do is determine a fixed length for each of these fields, so
that when I export this file to a CSV file, I get a file in which each column
has exactly the same fixed length.

For example, if my Excel file contains:

A B C
1234 ABC21 1234

and I want fields to have these fixed lengths:
A - 5
B - 6
C - 4

my CSV file should contain:
1234 ;ABC21 ;1234

Any easy way of accomplishing this? I tried custom cells but when exporting,
I lose the information.

Thanks in advance.

JE McGimpsey

One way:

http://www.mcgimpsey.com/excel/textf...tml#fixedfield


In article ,
"Plucky Duck" <Plucky wrote:

Hi there!

I have an Excel file with a series of fields, each in one column.

What I need to do is determine a fixed length for each of these fields, so
that when I export this file to a CSV file, I get a file in which each column
has exactly the same fixed length.

For example, if my Excel file contains:

A B C
1234 ABC21 1234

and I want fields to have these fixed lengths:
A - 5
B - 6
C - 4

my CSV file should contain:
1234 ;ABC21 ;1234

Any easy way of accomplishing this? I tried custom cells but when exporting,
I lose the information.

Thanks in advance.


Earl Kiosterud

Plucky,

Generally, you use fixed fields without the commas (fixed-length), or
variable-length fields with the commas (delimited). You're wanting to do
both. Are you sure? Why? Before you go to a lot of trouble, you should
probably manually make a small test file with NotePad, and see how the
program that will eventually read the file does with it.

There's a way, using the prn format in Excel's Save as, to do the
fixed-length. I think folks have had pretty good luck with it.

Both these issues are discussed at www.smokeylake.com/excel.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Plucky Duck" <Plucky wrote in message
...
Hi there!

I have an Excel file with a series of fields, each in one column.

What I need to do is determine a fixed length for each of these fields, so
that when I export this file to a CSV file, I get a file in which each
column
has exactly the same fixed length.

For example, if my Excel file contains:

A B C
1234 ABC21 1234

and I want fields to have these fixed lengths:
A - 5
B - 6
C - 4

my CSV file should contain:
1234 ;ABC21 ;1234

Any easy way of accomplishing this? I tried custom cells but when
exporting,
I lose the information.

Thanks in advance.





All times are GMT +1. The time now is 07:24 AM.

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