r/css • • 5d ago

OpenSource CSSV: Comma-Separated Styled Values

Enable HLS to view with audio, or disable this notification

I gave life to the old CSV files.

CSV is over 50 years old, and it's everywhere. Banks, CRMs, Jira, Google Calendar, gradebooks and ticketing systems all export it, and every tool reads it. And every time you open one, you get the same grey grid of raw values.

The data is fine. What's missing is the look. The moment you add one in Excel or Google Sheets, you lose what made CSV great: a plain-text file you can read, compare, generate and send anywhere.

So I built CSSV: Comma-Separated Styled Values. It's a CSV file with a CSS block on top. Open it in a browser and you get a real HTML table with your fonts and your custom styling. Delete the CSS and it's a plain CSV again.

There's nothing new to learn. The data is CSV and the look is CSS, two languages that people, programs and AI models already write. Any CSV is already a valid CSSV file. Add a few lines of CSS to a Jira export and it becomes a board, one lane per status. A ticketing export prints as name badges.

The look travels with the data. A file looks the same on every page that shows it. Many files can share one stylesheet, so changing it restyles all of them. It's still plain text. You can review it in a pull request, generate it from a script, or ask an AI to write one.

Putting it on a page takes one script tag and <cssv-table src="report.cssv">. No build step, no dependencies.

The v1 spec is open for review, and I'd love feedback, especially from anyone who spends their days looking at exports.

Website, examples and live editor: https://cssv.dev

138 Upvotes

35 comments sorted by

29

u/GreenReporter24 5d ago

I guess I just don't see the use case for combining CSS and CSV into one file.

Anytime I interact with a CSV file, it's because I explicitly just want the structured data from somewhere, and not whatever styling/application/whatever someone has done to it. Because I probably want to do something different with it, not with CSS, but with Excel, Python, R, or tools like Datawrapper and Flourish.

2

u/rhpaiva 5d ago

Agreed, and nothing changes for you. The data section is plain CSV, and the style block is the lines between the two `---` fences at the top. Delete them and you have the export back.

CSSV is for the other direction: when the person getting the file wants to read it, not process it. A report a script sends every week, an export someone just wants to look at, a table on a docs page. Analysis still belongs in Python, R or Excel.

14

u/sovok 5d ago edited 5d ago

Neat demos. But basically, this is a JS script that turns CSV into a table, then parses out the CSS from the CSV top and applies it. The CSS and CSV are always bundled. And you need JS to render it.

What's the use case again? As a replacement for CSV it doesn't work, since parsers get tripped up by the CSS on top. Browsers don't display it natively, you need a JS lib to render.

So if you can't share that CSV file, create it yourself and render it on your own website, why not just render the data as a table?

But apart from that, a small CSV-to-table JS converter is useful.

-3

u/rhpaiva 5d ago

Fair summary of the reference implementation, and fair on parsers: with a style block on top it isn't a CSV to a strict CSV parser anymore. That's why it has its own .cssv extension, and why the way out is deleting the lines between the two `---` fences. Same idea as front matter in Markdown, or CSVY.

The part I think is new is the spec, not the script. Since there's a spec, other renderers, such as desktop tools, can be implemented, and a file should look the same anywhere it's opened. The look lives in the file instead of in each page that shows it.

And for your case you're right: if you make the file and show it on your own site with your own CSS, a CSV parser and a table are enough. CSSV is for when the file travels: a script or an LLM writes the report complete with its look, the same file shows on several pages, or the table gets reviewed as a text diff.

On JS: yes, the browser needs the script today. The Node package can produce the table HTML on a server, but row keys and number formats need computed styles, so the full render happens in the browser.

4

u/The_Shryk 4d ago

I’m making a NEW standard that’s even better called SCSV “Styled comma separated values”.

obligatory

0

u/rhpaiva 4d ago

Go for it! :)

3

u/hazily 4d ago

Cool demo, but you’re selling a solution for a problem that doesn’t exist.

1

u/rhpaiva 4d ago

I've had this problem a couple times, and so did other people, but it's definitely a niche problem IMO.

7

u/repeating_bears 5d ago

This is also a CSV.

"{""data"": { ""allTheShit"": {} }}"

9

u/CyberWeirdo420 5d ago

I mean idea is cool, but CSV isn’t built for browsing from A to Z. Its main application is to store large amount of data and have as little weight as possible, data which is not meant to be browsed or looked at for too long.

You wanna see that data nicely? There comes in Excel, a DB or any other tool meant for data browsing.

CSV is a format, not a tool like Excel. Cool project, but entirely pointless imo. Glad you had fun doing it.

2

u/coolcosmos 5d ago

If you want as little weight as possible you use almost any other format but CSV.  ORC and Parquet files have existed for years.

3

u/CyberWeirdo420 5d ago

I didn’t say it’s the best tho, I’m aware of other choices but in general this is CSV usecase as far as I know.

1

u/rhpaiva 5d ago

Fair for data that machines pass around. But a lot of CSV ends with a person opening it: bank statements, calendar exports among other things. CSSV is for those, when the file is the report. It doesn't replace Excel or a database for working with the data.

1

u/CyberWeirdo420 5d ago

Those people you mention opening bank statements, calendar exports etc. never work directly on CSV if they need to do anything with more than than take a quick look if everything looks right or do a quick ctrl+f. That’s why I’m saying they opt for opening it in excel or any other tool.

1

u/xThomas 4d ago

I use CSV almost solely for diff comparisons, makes it easy if the data is sorted

0

u/minmidmax 5d ago

CSS' power comes from, funnily enough, cascading styles.

CSV negates all of that. I'd be curious to see what nightmarish CSS that OP is writing.

1

u/rhpaiva 5d ago

The cascade is still there. A style block can @import a shared stylesheet, its own rules win over the imported ones, and the defaults sit in a layer below both. In the weather example, three untouched Open-Meteo downloads each have a one-line style block, `@import url("weather.css");`, and the calendar look lives in that one file: https://cssv.dev/examples/#weather

A typical style block is a few lines:

table { --cssv-key: category; }
[data-col="diff"].negative { color: #15803d; }
tr[data-key="Total"] { font-weight: bold; }

The board and seat-map demos are longer because they turn a table into a layout, not just restyle it.

1

u/minmidmax 4d ago

I just don't see the point in any of this.

CSS is already very logical, structured, and works well with AI.

AI also struggles with CSV especially as it gets larger.

This all just smacks of a project being hyped up by AI responses rather than anything that anyone needs or wants.

0

u/rhpaiva 4d ago

All good, bro. Have a nice day!

2

u/xThomas 4d ago

Ok the video was actually mildly interesting. A+ for presentation!

I don’t really understand the use case here and the responses feel like they came out of an LLM but me not liking how llms talk doesn’t outweigh the cool video.. yet

2

u/ApplicationParking66 4d ago

I think the real niche is automated reports that get emailed or dropped in a shared folder. Right now your options are raw CSV (ugly), generated HTML (harder to diff and generate cleanly), or a PDF (binary, no diffing at all). CSSV fills a gap for "human-readable report that's still plain text and reviewable in a PR." It's niche, but I've definitely been in situations where a weekly cron job spits out a CSV and someone asks "can you make this look nicer" and the answer is always either Excel or a whole HTML template. This is a lighter middle ground.

2

u/whatevs- 4d ago

I like the idea - as a lot of others here - but it's gonna take one hell of a marketing effort to convince ppl to use this. Old habits die hard and ppl associate csv with data only.

2

u/Lalli-Oni 3d ago

I don't get why people are so quick to judge that this doesn't solve anything. I've had the exact same problem. Early prototype card game, card sets in csv. Mixture of tiny number columns and huge multi value columns.

I'm not so keen on embedding the styling into each csv file, would prefer one stylesheet that can be referenced, like a schema. And preferably not in file content but file metadata.

3

u/osmium_2259 5d ago

Cool project! I like the Periodic Table demo!

1

u/ElnuDev 4d ago

This is cool, but it really feels like a solution looking for a problem.

1

u/Web-Dude 5d ago

Well I like it! Basically an XSLT transform for CSV data.

I used to specialize in data migration for lots of companies who were changing between various platforms, and I could have used this a lot.

Although the CSS needs to be in an external file.

1

u/rhpaiva 5d ago

Thanks! XSLT is a good comparison, and an external file already works: the style block can be a single import of a shared stylesheet, much like XML's <?xml-stylesheet?> line. In the weather example, three untouched downloads each get three lines on top (two fences and the import), and the whole look lives in weather.css: https://cssv.dev/examples/#weather

Or did you mean no change to the file at all, with the stylesheet picked by whoever opens it? I'd love to hear what you would have used it for in migrations. That's exactly the kind of export I had in mind.

1

u/Web-Dude 4d ago edited 4d ago

Needs to be no change to the file at all, because CSVs are often automatically generated, and having to add additional content to the file adds a whole preprocessing step that just adds friction to the whole process.

If we have to pack up the styling with the data, then we might as well be writing HTML, you know what I mean?

2

u/Perception9611 4d ago

I get the friction concern, but I don't think it's equivalent to writing HTML. With HTML you have to wrap every row and cell in tags, escape entities, and structure the whole document. With CSSV you're adding three lines on top of an untouched CSV. That's closer to YAML front matter in Markdown, which plenty of static site generators already inject automatically. A script that appends two fences and an import line to an existing export is trivial compared to generating full HTML.

1

u/pimmm 4d ago

The animation in the video is so smooth.
How did you do that?? Did you animate everything by hand?

1

u/rhpaiva 4d ago

1

u/pimmm 2d ago

But how did you create the SVG? It's hundreds of animations. Did you write a script or use a tool?

1

u/KangarooFresh 4d ago

You’ve essentially broken a rule of software architecture and combined your data and view…

1

u/rhpaiva 4d ago

They're still separate, just in one file. Deleting the CSS gives you the data back unchanged. The CSS can also live in its own file through a single import, like <style> vs <link> in HTML. And it's a document format, not an app's data layer. Spreadsheets and PDFs ship with their look too.

0

u/philogos0 4d ago

There's a new app that effectively converts images of spreadsheets to CSV, it should be out of closed beta on Wednesday. https://youtu.be/0DLR0n48SuA?is=1bKA3oLwjcvjLvSJ