Processing CSV Files...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ian Craig Armitage

    #1

    Processing CSV Files...

    Hi,

    As strange as it sounds, i need to convert a csv file from one csv layout to
    another!...

    Basically both have fields as the first line (terminated with a lfcr) but
    after that the source file is pretty much continuous with a few lfcr's
    through the file..

    The output csv i require needs to have a "EOLEOL" at the end of each line
    entry...

    can anyone help me with the source code for this.. im using the free vb
    express 2005.

    Thanks


  • Spam Catcher

    #2
    Re: Processing CSV Files...

    "Ian Craig Armitage" <craig@icarmita ge.co.ukwrote in
    news:ulVbTzWxHH A.1188@TK2MSFTN GP04.phx.gbl:
    Hi,
    >
    As strange as it sounds, i need to convert a csv file from one csv
    layout to another!...
    >
    Basically both have fields as the first line (terminated with a lfcr)
    but after that the source file is pretty much continuous with a few
    lfcr's through the file..
    >
    The output csv i require needs to have a "EOLEOL" at the end of each
    line entry...

    There is a project called "FileHelper s" on SourceForge which handles CSV
    files. The project was a little buggy, but it has some nice helper
    functions for CSV.

    Comment

    • Michael D. Ober

      #3
      Re: Processing CSV Files...

      If the only thing changing is the end of line marker, do the following:

      dim fIn as new IO.StreamReader ("source.csv ")
      dim fOut as new IO.StreamWriter ("target.csv ", False,
      System.Text.Enc oding.ASCII)

      do while not fIn.EndOfStream ()
      fOut.Write(fIn. ReadLine() & "EOLEOL") ' Note that the write is not a
      writeline - you are specifying the end of line marker.
      loop
      fIn.Close()
      fOut.Close()

      Mike.


      "Ian Craig Armitage" <craig@icarmita ge.co.ukwrote in message
      news:ulVbTzWxHH A.1188@TK2MSFTN GP04.phx.gbl...
      Hi,
      >
      As strange as it sounds, i need to convert a csv file from one csv layout
      to
      another!...
      >
      Basically both have fields as the first line (terminated with a lfcr) but
      after that the source file is pretty much continuous with a few lfcr's
      through the file..
      >
      The output csv i require needs to have a "EOLEOL" at the end of each line
      entry...
      >
      can anyone help me with the source code for this.. im using the free vb
      express 2005.
      >
      Thanks
      >
      >

      Comment

      Working...