Search code examples
csvexport-to-csv

Double quoted values no longer escaping comma in CSV


I'm trying to create a csv file that has cells that have values with commas in it. I've already browsed a lot of threads on how to escape the comma to be displayed in a cell and not to be treated as data separator. All of the solutions I've found so far is about placing the value with comma in a double quote but it seems not working at all.

Here's the text file

enter image description here

While here's the result when opened in Excel

enter image description here

Am I doing it wrong? Or is there any good alternative to escape the comma on csv file?


Solution

  • Solved it. If you're encountering the same problem, all you have to do is to make sure there are no spaces before and after each comma separator.

    In my case, I solved it by changing my text from this

    col1, col2, col3
    val1, "val2, with comma", val3
    

    to this

    col1,col2,col3
    val1,"val2, with comma",val3