Escape characters for .csv files

Discussion in 'Programming' started by redhits, Aug 14, 2009.

  1. #1
    is there an escape character for the csv file?

    can i have something like this?

    cell1,cell2,cell3,cell1\,cell2\,cell3 ? !
     
    redhits, Aug 14, 2009 IP
  2. mfawn

    mfawn Active Member

    Messages:
    573
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #2
    I think its more the program reading and not the csv file. A csv file is just text so when you try to read it back into something and it sees a \, or something then it will know to put in a , and not go to the next data cell.
     
    mfawn, Aug 14, 2009 IP
  3. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #3
    So ... nothing can help me then? :(
     
    redhits, Aug 21, 2009 IP
  4. mfawn

    mfawn Active Member

    Messages:
    573
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #4
    I think it all depends on how it is being read back. What program as you using to read the csv file?
     
    mfawn, Aug 21, 2009 IP
  5. jamespv85

    jamespv85 Peon

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I don't think it can be escaped with a "\" as it (the comma) will still get interpreted as another column.

    If there are "," values that are in your data, you can try another delimiter that is hardly being used at all.
     
    jamespv85, Aug 21, 2009 IP
  6. pneulameiro

    pneulameiro Peon

    Messages:
    440
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    it depends of the program that created the csv. IF you will create the csv then you can put these caracters in the csv to separate cells and colums. I use the open office calc (a kind of open source office package) and it has many options of escape characters to read and format a csv.
     
    pneulameiro, Aug 24, 2009 IP