+ Reply to Thread
Results 1 to 6 of 6

How to save an excel in a pipe delimited format?

  1. #1
    Registered User
    Join Date
    06-08-2009
    Location
    Kolkata,India
    MS-Off Ver
    Excel 2003
    Posts
    4

    Unhappy How to save an excel in a pipe delimited format?

    Hi Friends,
    I have an excel sheet which I need to store as a pipe delimited text file.
    This should be done using macro.
    For example:
    input:

    45 56 78 abcd

    output:

    45|56|78|abcd|

    I cannot create a tab delimited or csv file and then replace manually. It has to be done automatically.

    Please Help!!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to save an excel in a pipe delimited format?

    Hello princesouvik,

    I have a few questions about what you want to do.
    1. In your example, is each cell in a row to separated by a pipe value?
    2. Are the number of fields in each row the same?
    3. Does text need to be enclosed in quotes or preceeded with an accent mark (`)?
    4. Do numbers need to include separators like decimal points and commas?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-08-2009
    Location
    Kolkata,India
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to save an excel in a pipe delimited format?

    The following is a sample input:

    004011641391 1040 d 324.63 09/06/2009 DEC
    004005562228 1040 d 134.66 01/05/2009 OTH
    004015902314 1040 d 801.83 06/06/2009 GNA
    004029976905 1040 d 1625.83 09/06/2009 DEC
    004026411232 1040 d 494.82 06/06/2009 OTH

    The following is a sample output:

    004011641391|1040|d|324.63|09/06/2009|DEC||
    004005562228|1040|d|134.66|01/05/2009|OTH||
    004015902314|1040|d|801.83|06/06/2009|GNA||
    004029976905|1040|d|1625.83|09/06/2009|DEC||
    004026411232|1040|d|494.82|06/06/2009|OTH||

    Moreover the input file has the same number of fields in each row.
    No quotes are present, or any special char, except "/" in date field
    Decimal points may and may not be there.

    Hope this was helpful.

    Thanks

  4. #4
    Registered User
    Join Date
    06-08-2009
    Location
    Kolkata,India
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to save an excel in a pipe delimited format?

    Guys any help with this???!

  5. #5
    Registered User
    Join Date
    06-26-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: How to save an excel in a pipe delimited format?

    Hi princesouvik,

    Copy and paste the following code and it should work.

    PHP Code: 
    Columns("A:A").Select

        Selection
    .Replace What:=" "Replacement:="|"LookAt:=xlPart_
            SearchOrder
    :=xlByRowsMatchCase:=FalseSearchFormat:=False_
            ReplaceFormat
    :=False 

  6. #6
    Forum Contributor
    Join Date
    04-03-2007
    Location
    Auckland, New Zealand
    MS-Off Ver
    2007
    Posts
    137

    Re: How to save an excel in a pipe delimited format?

    Are you able to post a small sample spreadsheet?

    It's still unclear whether you input data is a single cell (with output elements currently separated with a space) or inf each element is in a separate cell.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1