5 ms·
Perhaps by "correct way" you meant "dodgy hack to make Excel happy and risk breaking more sensible implementations"? Excel may predate the RFC but AFAIK MS did
by vertere 6y ago
Perhaps by "correct way" you meant "dodgy hack to make Excel happy and risk breaking more sensible implementations"?
Excel may predate the RFC but AFAIK MS didn't invent or coin the term CSV, so you can't just say whatever Excel does is correct. The RFC is loose because of nonsense like this, it doesn't mean it was ever a good idea.
- _pmf_ 6y agoDo you want to be a useless sophist or develop software?
- vertere 6y agoI sure don't want to have to deal with people putting `="01"` in CSV files.
- altacc 6y agoWe have multiple legacy systems where I work, communicating via batch csv files, some of which are authored & curated by staff in Excel. I can confirm that doing this would be a very bad thing indeed and make our systems grind to a halt.
- dragonwriter 6y agoFor CSV that isn’t solely targeting Excel, hacks around the way Excel works are useless.
- edejong 6y agoI guess the HN audience has voted. The result is: hacking around Excel stupidities is itself a stupid idea. If you want Excel to understand your output, perhaps use a library which can write xlsx files.
- OskarS 6y agoThe reason you use CSV is that you want to use it with software that ISN'T Excel. Otherwise you'd just use .xlsx. No other software uses this convention, and it's not correct CSV.
- deleted 6y ago[deleted]
- stjohnswarts 6y agoHow in the world is Excel supposed to know which fields you want to be numbers and which to be strings? CSV doesn't have that info built in unless you surround the number with quotes and you select the right process. Excel isn't just a CSV importer, it reads all sorts of files, and it needs some help if you expect it to work. What ever happened to process and a sense of responsibility and craft in your work?
- vertere 6y agoChoosing based on whether it's in quotes seems like a better solution than using an equals sign. Not everything follows that convention admittedly, but not everything understands the '=' either. Or it could just treat everything as text until a user tells it otherwise. But none of that is really the point. Because CSV files aren't just for importing into Excel. One of their main benefits is their portability. In other situations column types might be specified out of band, but even if not, putting equals signs before values is unconventional, so more likely to hurt than help. And in the cases it might help, i.e. when you only care about loading into Excel, then you have options other than CSV, rather than contorting CSV files for Excel's sake. > What ever happened to process and a sense of responsibility and craft in your work? I actually have no idea what you are on about. I'm talking about the "responsibility and craft" of not producing screwed up CSV files. Why do some people find that so offensive? Yes, it is not inconceivable that there could be some situation working with legacy systems where putting `="..."` in CSVs is, unfortunately, your best option. Sometimes you do have to put in a hack to get something done. But don't go around telling people (or yourself) that it is "the correct way".