Issues converting csv to xls in Java? Only core Java experience needed - question not related to import

后端 未结 4 1493
甜味超标
甜味超标 2020-12-22 08:35

First of all, I understand that it\'s unusual that I want to up-convert like this, but please bear with me. We get these csv files via website export and we have no options

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-22 08:55

    I know this doesn't really help you with your immediate problem, but my advice is: don't do it at all. You'll be very lucky if you get away with just dealing with embedded commas. What about embedded double quotes? Embedded line breaks? etc. etc...

    Quite honestly? The answer is to find a library which parses CSVs and use that. I'm pretty sure nearly every single developer in the world has fallen into the "oh, CSV is such a simple format, I'll parse it myself" trick. I know I have.

    There's a great post about the problems with roll-your-own CSV Parsers which I love referring people to (I'm cruel like that). It's a .NET-related post, but it still applies to your situation. Note that you're only up to step #2 of 5... there's a lot to go.

提交回复
热议问题