3 ms·
> Why can’t we have a format where Does Excel support it? No? Then that's the end of that. Excel is tabular data to all non developers. The formats support
by Pxtl 5y ago
> Why can’t we have a format where
Does Excel support it? No? Then that's the end of that.
Excel is tabular data to all non developers. The formats supported by Excel are the whole thing.
And if we're inventing a CSV-like format that uses a more convenient character than quotes and commas, maybe jumping to a non-displayable non-typeable character isn't the best?
Honestly, if I were inventing a table format, I'd use a strict subset of HTML5 tables. Strip it down as hard as possible to the bare minimal elements - no unneeded close tags. The only real flaw is that their encoding of whitespace and escaped chars are verbose and ugly.
<!DOCTYPE html>
<html>
<head>
<title>Example workbook</title>
<meta charset="utf-8">
<meta name="subtype" content="tabular data">
</head>
<body>
<table><caption>Persons</caption>
<tr><th>Name<th>Address
<tr><td>Alice<td>123 Fake St, Faketon FA 12345
<tr><td>Bob<td>789 Any Pl, Anytown AY 54321
</table>
<table><caption>Cars</caption>
<tr><th>Make<th>Model
<tr><td>Buick<td>LeSabre
<tr><td>Pontiac<td>Vibe
</table>
- adgjlsfhk1 5y agoit will also be at least 2x bigger on disk for no reason.
- Pxtl 5y agoYour data must be very sparse or include a lot of escape chars for that. I've seen a lot of CSV where everything is quoted, meaning that the cell separator is effectively "," which is only one character less than <td> and still beats the pants off of JSON or XML. imho, it would be a good compromise, in that there's already partial tooling and GUI support.
- prepend 5y agoBut usually it will be 1 character vs 4. So that adds a lot of space that doesn’t add much value. It’s also harder to read.
- Pxtl 5y agoI would say invisible control characters would be even harder to read.
- hermitcrab 5y agoUS and RS characters are visible in some editors, e.g. Notepad++.
- dtech 5y agoExcel actually opens HTML tables
- tony-allan 5y agoThis is a very cool idea but why not just add the closing tags and have a minimal format that is also valid HTML and can easily view the data by pointing your browser at the file? It's already a universal format and as dtech mentions below, you get Excel compatibility. I would also add headers and an optional type attribute... <tr> <th data-type="int">Age</th> </tr> If the file is too big then you probably need compress it or use a more appropriate format.
- Pxtl 5y agoThe document I posted was valid html6 -- all of those end tags are optional. From an XML purist's perspective that's abhorrent, but if we're trying to make a terse table format skipping the close tags is good.
- tony-allan 5y agoThis also allows CSS selectors such as: a[data-type="int"] { color: green; }
- zzo38computer 5y agoIs <meta name="subtype"> used anywhere else? (I had considered <html application="tabular-data">; my reason was that it seems to work better with user CSS, and might be simpler to parse in other cases too.)
- Pxtl 5y agoI can't remember where I saw "subtype". Probably something I misrememebered. Yours is better.
- elcritch 5y agoI've pondered exactly that. After a previous HN thread, I tried my hand at writing a specification that was minimal as possible but followed HTML5. For example many end tags are optional like `tr` and `td` end tags. Though I pulled in RDFa for richer data types. Here's the GitHub repo for what I like to call HSV5: https://github.com/elcritch/hsv5/blob/main/README.md https://github.com/elcritch/hsv5/blob/main/README.md ;) And an example of the format, pretty similar to yours: <!doctype html> <html vocab="https://hsv5.org/" typeof="hsv5" lang="en"> <title>sensor data @ 2020-05-26T00:00:00.000Z</title> <table> <thead> <tr> <th property="time/iso">Timestamp <th property="temperature/celsius" datatype="f32">Temperature <th property="humidity/percent" datatype="f32">Humidity <th property="pressure/kPa" datatype="f32">Pressure <tbody> <tr>2020-05-26T00:00:00.000Z<td>8.32<td>75.5<td>102073 <tr>2020-05-26T00:01:00.000Z<td>8.31<td>NaN<td>102074 <tr>2020-05-26T00:02:00.000Z<td>8.31<td>75.4<td>102074 <tr>2020-05-26T00:03:00.000Z<td>8.30<td>75.4<td>102074 <table>
- qayxc 5y agoWorks well until some joker comes along and puts <td> or <table> in your data :)
- Pxtl 5y agoWell yeah, no matter what escape chars will be a challenge. Also whitespace. Imaging all the values if you import a whitespace-heavy string.