6 ms·
Objectively, CSV is terrible for humans despite being a plaintext format. No one reads CSVs: they're incomprehensible since the columns are not aligned with the
by habitue 5y ago
Objectively, CSV is terrible for humans despite being a plaintext format. No one reads CSVs: they're incomprehensible since the columns are not aligned with the headings. (You might be drawing an analogy with JSON, which is often human readable because it puts the keys right there next to the values).
The best that can be said for its simplicity is that it's easy to write code that can dump data out in CSV format (and to a lesser extent, it's easy to parse it, though watch out for those variants). This is not a really strong argument, most everyone is going to use a library for serialization, there's no reason to write your own unless it's for learning.
- fighterpilot 5y agoI'm a human and I love CSVs. What other format can I open in a spreadsheet, access through cat/grep/awk, and easily load into any programming language? Any other format has to sacrifice one of these three things, and that's bad. It's this trifecta that makes it so versatile and human friendly.
- madaxe_again 5y agoDeveloper friendly. Not human friendly. I used to receive CSVs of product data from clients, which they often handcrafted or manipulated by hand, and inevitably, and I mean inevitably, broke. Of course, excel will make just as much of a mess - when the client hands back their sheet with all of their UPCs expressed as exponents and æ€ ligatures jammed next to every apostrophe, there’s no guessing as to what happened. In theory, it’s a great and simple format. In practice, it causes much pain.
- asdff 5y agoHonestly though, if people are doing that with CSVs there is no system where they won't also go off the reservation and do something insane with an excel file or sqlite or whatever. At least with CSVs there are common lines of code all around the internet to wrangle all sorts of issues.
- bobthepanda 5y agoAnything written by hand will be screwed up. Chances are if they're writing it by hand and it's badly formatted, they're not using something that has input or output validation anyways, and they're probably not going to budge from whatever workflow they're using.
- xtracto 5y ago> access through cat/grep/awk, and easily load into any programming language Until the CSV fields contain commas themselves. Even if fields are surrounded by "".
- megous 5y agoThen you just switch to a 3-line php script (fgetcsv() in a loop) and continue on... :)
- breck 5y agoSome people like me never generate CSVs like that. If someone sends me a CSV with quotes, I reject it and say "clean up your data". It's okay to say, "we're not going to allow escape characters in our CSV grammar. We're going to have a higher standard"
- danellis 5y agoNot everyone has the option of rejecting it, though. Sometimes you need that data and have no control over how it's being generated.
- the_only_law 5y agoI recall one of my old Phones could dump SMS messages as CSV. I wanted to be build and interface that would let me search through my messages. Turns out when you have data that contains both commas and quotes things get screwey real quick. You could have quoted data like: 123,ABC,”,””,456 Where ,” is column data. I think that standard method is to double quote the field, but the dump sure wasn’t doing that for me, plus what happens when the data is something like abc””,?
- deleted 5y ago[deleted]
- rendall 5y ago> 123,ABC,”,””,456 That is badly formatted CSV, assuming ” is a double-quote. Double-quote (") is how you escape commas, so the 3rd entry will make a parser barf, since there is no close quote. It should be 123,ABC,"","",456 > Turns out when you have data that contains both commas and quotes things get screwey real quick. Not really. It's pretty logical. If the entry has even one comma, put quotes around it. If it also has quotes, double each of them. Otherwise don't worry about it. > what happens when the data is something like abc””,? abc"", becomes "abc"""","
- wutwutwutwut 5y agoWhich format would you propose if I am writing a .NET tool to produce a file to be consumed by Excel?
- habitue 5y agoI would expect .NET to have excellent .xlsx capabilities? Most libraries have an easy way to write those from tabular data.
- wutwutwutwut 5y agoWhy would you expect that?
- izietto 5y agoI like CSV instead, it's pretty intuitive to me to provide a list of records separating each column by comma and each record by newline.
- rutthenut 5y agoSurprised you would think that JSON is more human-readable, as the layout of that makes it visually quite appalling - not so bad when through a pretty-printer utility, admittedly, but may as well go for XML as another use case
- anigbrowl 5y agoFor ages I would just dump json files in a browser and let it auto-pretty print it for a first look. A while back I discovered https://dadroit.com/ https://dadroit.com/ which is small (in feature set) but perfectly formed (nicely designed and extremely fast, even on huge files).
- godshatter 5y agoI try to use tab-delimited files when writing out columnar text to be loaded into something else (assuming it can parse them). It's even easier to read since you don't have extraneous commas and double quotes everywhere and most viewers will line things up to some degree via the tabs. Tabs are less common in data fields (at least when compared to double quotes and commas), at least in my experience.
- asdff 5y agoThe columns are aligned with the headings if you use the tool for the job, like R or python or awk or insert favorite cli parsing method here.