Half a croissant, on a plate, with a sign in front of it saying '50c'
h a l f b a k e r y
The best idea since raw toast.

idea: add, search, annotate, link, view, overview, recent, by name, random

meta: news, help, about, links, report a problem

account: browse anonymously, or get an account and write.



PSV - Pipe Separated Value format (markdown table style!)

As opposed to CSV comma separated file
  [vote for,

Why not use the same parsing logic used for parsing github style tables as an alternative to CSV file format?

It means you can use comma! Plus such file format can clearly and unambiguously tell you if it has a header cell or not. We could also extend this to make it more suitable for more complex sheets. But only as long as it keeps to the markdown ethos of easy human readability.

Could be baked into most apps as an alternative to CSV.



# What is this?
no pipes here means it is just comments. Every row needs to start with a "pipe" to be recognized as a start of a table row. A header row is indicated by a sequence of "|--|" just under the header row.

## Sheet Name 1
| Tables- | Are______ | Cool |
| col 1 is | leftaligned | $1600 |
| col 2 is | centered__ | $12 |
| col 3 is | right-aligned | $1 |

## Sheet Name 2
optional comments
| Tables- | Are______ | Cool |
| col 1 is | leftaligned | $1600 |
| col 2 is | centered__ | $12 |
| col 3 is | right-aligned | $1 |



But yea, if we really do think this is a good idea. We really should create a standardization organization to avoid the diverging implementation that affects CSV. (Along with good instructions of implementing parsers. Like how json was able to explain how it works succinctly)

Bonus: Could we somehow also include formula support? e.g. `=SUM(A5:B7)` without clashing with normal strings and numbers? Maybe `| "43"="SUM(A5:B7)" |` to show calculated value and the formula that was used?

mofosyne, Sep 09 2015

Markdown Table Generator http://www.tablesge...com/markdown_tables
[mofosyne, Sep 09 2015]

CSV on the Web Working Group http://www.w3.org/2...csvw/wiki/Main_Page
[mofosyne, Sep 10 2015]

Side Thoughts: Promoting pipe tables as a potential alternative to .CSV format (e.g. .PSV ?) http://talk.commonm...format-e-g-psv/1862
A post in commonmark discussion [mofosyne, Apr 22 2016]

Asciidoc tables (in Asciidoctor) http://asciidoctor....user-manual/#tables
[Ian Tindale, Jan 26 2018]


       Windows regional settings allows choosing any character you like as a "list separator". It defaults to comma, but if you change it to pipe, Excel will use pipes as separators when sheets are saved as CSV.   

       Also you can use commas in CSV, just "enclose, the, data, in quotes". Excel will do this automatically if the cells are properly formatted.
tatterdemalion, Sep 09 2015

       How do you do you clearly define header rows?   

       How do you specify multiple sheets?   

       Or include the source behind a field?   

       What about comments?   

       I think it would be good to add these specs in clearly.
mofosyne, Sep 09 2015

       The simplest way to do that would be to add a markdown format to Excel's "Save as..." dialog. All the things you just asked about could be formatted properly.   

       When would someone need this? Beyond posting a reddit comment, what use would a markdown formatted spreadsheet be?
tatterdemalion, Sep 10 2015

       I've used, and promoted the use of pipe (or where Lotus notes is involved - tilde - pthew) separated "character-separated-value" files for the last 15 years, and in the small niche area I've worked, it's become the norm, along with a simple headers row at the top.   

       The reason has tended to be that we were too lazy to write a proper parser, and this was the quickest, easiest way to load data without screwing things up.   

       That being said, there ought to be a nice, single data standard that we could all gather around that manages single and double-quotes, escaping backslashes and all the usual stuff in a single, simple and commonly accessible way that isn't XML.   

       I'm not so keen on this markdown flavoured version, since if your tables are small enough to be read by a human in markdown, they deserve being presented in a pdf, html, tableau or some other nice-to-read format - mixing the two can make things tricky - though there are precedents (perhaps) in mysql (and to some extent oracle's sqlplus) which exports select statements wrapped up in tabularising decorations like this as default.   

       Excel, apart from use as a kind of desk-calculator, is the spawn of the devil and should be hung-drawn and quartered and have its head displayed atop a pike along London Bridge.
zen_tom, Sep 10 2015

       So you would prefer a standard that implements just the "markdown tables" aspect of consistent headers rows recognition? (Thus removes all other other convenient fluffs)? That would certainly keep it simple, and still get the advantage of super simple parsing of header rows, and data rows.   

       Maybe there is a way to define the standard that allows for graceful failing? So you could implement the most basic parser (one sheet, no comments), but then optionally support a subset standard that supports the above plus a bit more.
mofosyne, Sep 10 2015

       Are there situations in which tabs won’t do the job? I’ve seen tab separated, not so much comma separated (which would be utterly stupid, I actually use commas for what they’re supposed to be for, and I imagine lots of other people do). Tabs are what should be used, it has no other purpose other than a separation of tabular data, and that’s what’s trying to happen here. It’s what they’re for.
Ian Tindale, Sep 10 2015

       I could probably find the code I wrote to translate CSV to PSV, if you want it.   

       It was written in Turbo Pascal 3 when that was new.
lurch, Sep 10 2015

       TSV (Tab-Separated Value) is a thing already. Does not that work?
notexactly, Apr 24 2016

       I suggest Obscenity Separated Value format become the standard that everybody must use.
Ian Tindale, Apr 24 2016

       ID F***K Name F***K Description
F***K F***K F***K F***K F***K
0 F***K Dog F***K Floppy Ears
1 F***K Cat F***K Owns humans
2 F***K Bird F***K Chirpy

       Hmmm... Could work?
mofosyne, Jan 26 2018

       For this idea, this is quite similar to how Asciidoc does tables (see Asciidoc – I always suggest people see Asciidoc, I use it all the time, it is better than Markdown for almost everything other than entering content into a web text box).
Ian Tindale, Jan 26 2018

       I have just seen a database export that we think is from MS SQL Server, and it's in the form of text files where the values are separated by pipes. It's exactly like CSV or TSV, but using pipes instead of commas or tabs; it's not like Markdown. However, and I've never used MS SQL Server so I don't know if this is normal, it appears to have two things wrong: Every single character in the files is separated by a space, and when we try to copy and paste anything out, all we get is the first non-space character, so we can't even paste the spaces into a Unicode inspector…
notexactly, Feb 07 2018

       Nasty; sounds like a job for a single-use software tool, and some quality cursing time in front of a debugger.
pertinax, Feb 07 2018

       Would hatemail to the software provider help with crappy data exports?
mofosyne, Feb 07 2018

       //Every single character in the files is separated by a space//   

       It might be encoded as UTF-16, which is popular on Windows, and often looks a lot like this if you don't decode it correctly.
Wrongfellow, Feb 08 2018

       I always read those encodings as "WTF-[whatever]".
pertinax, Feb 08 2018

       It was indeed UTF-16, as I discovered later. I might have saved some time on that if I'd checked for suggestions here.
notexactly, Feb 10 2018


back: main index

business  computer  culture  fashion  food  halfbakery  home  other  product  public  science  sport  vehicle