alt.hn

5/22/2025 at 12:31:01 AM

Display any CSV file as a searchable, filterable, pretty HTML table

https://github.com/derekeder/csv-to-html-table

by indigodaddy

5/22/2025 at 12:20:01 PM

> I'm just a sysadmin but I love piecing together stuff like this.

I'm a developer and piecing stuff together is my favorite part of the job. The joy is in the design, the actual coding is just a means to an end.

I've written similar browser tools for handing tabular data. One neat thing I've learned is if you copy and paste from Excel into an html `textarea`, you get the data as tab delimited text. Add a `paste` event handler to the `textarea` then parse the data in code.

by waltbosz

5/22/2025 at 5:50:16 AM

I know PowerShell is surrounded with polarized opinions, but that's one of the things it's amazing for. Import-Csv with Out-GridView gives nice results and it can be just a one-liner wrote from memory.

Just a reminder that it's possible and often built into our work environments, while we pretend it's not there.

by szszrk

5/22/2025 at 4:38:39 PM

Pwsh is actually pretty good.

My hottest of takes...Powershell is the easiest way to write consistent scripts across the big three OSes.

by jayd16

5/22/2025 at 3:33:34 PM

PowerShell is the first thing I install on my Linux workstation/jump host because of those built-in Import/Export/Convertto goodies. Import-Excel module works on Linux too. Too bad the Invoke-WebRequest uses basic parsing only, it used to parse the actual DOM with JS and all, but I guess that was a security issue.

by bblb

5/22/2025 at 3:58:51 PM

Nah, that required IE which isn't available on Linux.

by majkinetor

5/22/2025 at 4:08:13 PM

Does it write UTF16 on linux too? That's my biggest gripe with powershell redirections and Out-File's on windows.

by porridgeraisin

5/22/2025 at 7:08:48 PM

install tabview?..

by MstWntd

5/22/2025 at 6:39:29 PM

I have a simultaneous respect for the power and capabilities of PowerShell while also for some reason harbouring a very strong loathing of it. I just viscerally dislike it. Maybe it’s the syntax… or perhaps just some latent decades-old Windows admin trauma…

by tailspin2019

5/22/2025 at 2:47:55 PM

I don't use Windows as my daily driver, so I had no idea Import-Csv existed until last week, when I pasted a shell command that I had run on my Mac, and asked it to write something that would work for Windows (for my colleague).

I hadn't understood how different Powershell is, compared with cmd.exe of old.

by rahimnathwani

5/22/2025 at 3:43:50 PM

They should really have called it PowerScript. It's the full blown .NET ecosystem.

by razakel

5/22/2025 at 4:56:25 AM

Alternatively, feed your spreadsheet file (CSV, XLS, whatever) to Google Sheets and then select File > Download > Web Page (.html) – especially when you have a ton of formatting (font, colors, borders, whatnot)... the result looks great!

by 34f34f3

5/22/2025 at 2:07:54 PM

Alternatively, use visidata (https://www.visidata.org/) in the terminal. Supports xls/xlsx too! One of my favourite tools for terminal data exploration (along with jq, fx, and jet).

by nathell

5/22/2025 at 8:35:24 AM

But does this include options for sorting and filtering?

by bryanhogan

5/22/2025 at 3:57:23 PM

Does that do the Excel thing where it crushes all the numbers to exponents?

by ThrowawayTestr

5/22/2025 at 5:42:41 PM

hey all - I'm the creator of this tool. very cool to see a project I wrote 10 years ago get some recognition. Sorry about the jQuery. Pull Requests welcome!

by ederderek

5/22/2025 at 5:00:54 PM

I use sqlite3 for this task because I use a text-only browser to read HTML. It has no Javascript engine. The HTML tables prooduced by sqlite3 do not require Javascript.

by 1vuio0pswjnm7

5/23/2025 at 12:31:13 AM

That was my thought. Sqlite3+datasets works great for this

by schwartzworld

5/22/2025 at 1:53:24 PM

This is neat. I had a recent need to do something similar, but ended up using Grist CSV Viewer[1], which I think is a bit more feature complete. I had ChatGPT create an HTML file that would let me paste the CSV instead of loading a specific file and it worked pretty well while being more convenient than loading the CSV into Google Sheets or whatever.

[1] https://www.getgrist.com/csv-viewer/

by RUnconcerned

5/22/2025 at 5:56:22 PM

Thank you for sharing this! I‘m using pivottable.js but I noticed that it‘s sometimes hard to understand by my colleagues. Will Grist definitely give try.

by hilti

5/22/2025 at 1:33:37 AM

I combined this with a simple API to update a CSV file using Deno/deno-csv library, allowing an Ansible job to easily update a CSV file via the API with Ansible URI module, and then have that same CSV file viewable/downloadable in a simple and easy/dashboardy way (with CSV-to-html-table). Copilot created the Deno/deno-csv CSV API code and then with a little back and forth I added static website functionality (to serve the CSV table), and I had a /view and a /update route. I'm just a sysadmin but I love piecing together stuff like this. Thanks Derek!

by indigodaddy

5/22/2025 at 1:30:39 PM

I kind of want to fork it and work out the jQuery dependency.

*EDIT* Would probably be easier to start a new one and maybe use PapaParse to parse the CSV.

by hk1337

5/22/2025 at 2:16:02 PM

I think this fork actually uses papaparse. I actually thought it was slightly less attractive though and also it did not have the download csv capability:

https://github.com/pavelsr/csv-to-tablesorter

by indigodaddy

5/22/2025 at 2:04:04 PM

My first thought too. Though, I'll probably write it as a custom element so that I can pass a csv path to it via an attribute. Seems like a really handy thing to have, and I'm already working on a similar type of thing for pdfs. Definitely in the 'everything is a nail' phase of building a library of custom elements.

by catapart

5/22/2025 at 2:28:52 PM

I was thinking just a table element with data attributes and maybe a class name.

by hk1337

5/22/2025 at 4:26:19 PM

For sure! I was just thinking of wrapping that table with an element so I don't have to call "load" or "init" or whatever from a separate script. I'm a big fan of html that works well and tables are pretty awesome for tabular data.

by catapart

5/22/2025 at 1:51:52 PM

Nice. Its interesting to me that searching and filtering isnt something that http://csvbase.com has.

by mattsouth

5/22/2025 at 2:53:42 PM

I looked at that too for my use case. It was super cool, but I needed something to utilize a CSV that I did not have to initially upload through webui, and also wanted it to be downloadable, so this hit those checkboxes for me.

by indigodaddy

5/22/2025 at 2:37:52 AM

Love this idea, wish I could pipe a CSV right to the tool though!

by strunz

5/22/2025 at 6:22:03 AM

Could be easy enough to make a CLI tool that opens a browser to an HTML file in /tmp

by stevenpetryk

5/22/2025 at 1:28:50 AM

How does this handle CSV's with no headers, or data that's offset from the top? (e.g. a row for title and subtitle, before the table headers & data)

by promiseofbeans

5/22/2025 at 1:47:14 AM

That is classified as an edge use-case. Realistically speaking I don't think the point of this hastily whipped up demo was to be a replacement for google sheets.

by mokanfar

5/22/2025 at 2:11:55 AM

Yeah but since it claims "any CSV file", and CSV files are widely known to be variate, I didn't expect it fails to work on edge use-cases.

by Bimos

5/22/2025 at 10:52:11 AM

I was thinking of it as competition for GitHub’s CSV reader in repositories.

by hk1337

5/22/2025 at 1:41:07 AM

Great question. If it can’t skip lines, I’m out.

by brothrock

5/22/2025 at 6:36:36 AM

or like contribute...

by nxpnsv

5/22/2025 at 3:25:04 AM

This is amazing!! I finally have an excuse to use spreadsheets again! I've been avoiding them for years, Legitimately.

by sn0n

5/22/2025 at 4:30:45 AM

What did you use instead?

by dddw

5/22/2025 at 1:50:39 AM

Obligatory suggestion to developers who use this: Don't copy&paste reuse that custom formatting code from the demo for arbitrary CSV, since the code inserts arbitrary strings into both HTML attribute value and CDATA contexts, without escaping special characters.

    return "<a href='" + link + "' target='_blank'>" + link + "</a>";

by neilv

5/22/2025 at 6:52:23 AM

the creator even acknowledged the risk in the sample... but i do not understand why not create a more secure sample first time? since people will absolutely copy to test.

by rafaelgoncalves

5/22/2025 at 8:38:04 AM

I was actually looking for something like this! It seems to be a bit old though, does it work well? Also I can't seem to filter columns?

Are there other tools like it?

Got a collection of larger CSV files that I wanted to include on a Astro Starlight project of mine.

by bryanhogan

5/22/2025 at 4:57:51 PM

Custom formatting should be called js column wrapper.

I thought custom formatting would be changing colors and widths text wrappings.

And maybe add a head wrapper?

by nashashmi

5/22/2025 at 5:22:51 PM

If the author is here, I would love a JSON to pretty HTML table too (with all the features this one has)!

by davidcollantes

5/22/2025 at 5:47:18 AM

Ha, I'm working on a similar utility with some extra features also enabling WASM that might help in case of larger files.

by magesh_magi1

5/22/2025 at 3:24:40 PM

Nice work! Immediately usable.

by CommenterPerson

5/22/2025 at 3:45:19 AM

i’m gonna test this on a 52k rows document, very curious if it can handle that

by joseangel_sc

5/22/2025 at 3:48:37 AM

Perhaps turn paging on in the config for a very large CSV?

by indigodaddy

5/22/2025 at 2:00:51 PM

52k rows is a large CSV? BWAHAHAHA. I guess it is all relative.

by hermitcrab

5/22/2025 at 5:07:59 AM

I wrote this long ago. Looking at it I'm really a master spaghetti coder.

https://jsfiddle.net/ypfr98su/5/

by 6510

5/22/2025 at 9:36:15 AM

Spaghetti code is underrated.

by Propelloni

5/22/2025 at 2:13:32 AM

I was wondering why this wasn't expressed as a webcomponent, then saw it's a decade old. Nice.

by pphysch

5/22/2025 at 9:39:06 AM

Ha I didn't notice the date but I did notice that was based on datatables.net a very cool library.

by vasvir

5/22/2025 at 5:31:11 PM

Datasette (open source project by @simonw, 10K stars on GitHub) excels at this: https://datasette.io/

Plugins like datasette-extract (AI powered data extraction) are amazing: https://www.youtube.com/watch?v=g3NtJatmQR0

by cbeach

5/22/2025 at 6:43:49 PM

Datasette isn't really comparable to this. This is just about a simple, clean, webview of a CSV. Datasette isn't exactly that, and for sure not out of the box like that nor as simple to plug and play for this exact use case. Datasette is obviously awesome and very powerful, it's just a different tool and don't think it overlaps much with most use cases of this particular project.

by indigodaddy

5/22/2025 at 3:32:15 AM

Pretty cool. I'm wondering how large of a CSV you could feasibly load with this. I always have to manually open CSVs in text editors if they're too large for Excel, so if this is a better UI for it that can handle large files I will definitely use this.

by 65

5/22/2025 at 3:52:47 AM

Perhaps setting paging to true would improve the handling of a very large CSV

by indigodaddy

5/22/2025 at 2:09:43 AM

Dang, I'm not the author, so do not think this should be a show HN, at least not with me remaining as the submitter. I did not submit it as such, and then later an admin edited it to a show HN, and put my comment (that I added for context later for how I made use of the tool) as the description. That blurb currently as the description should probably be returned to a plain comment. All I did was stumble upon Derek's repo when I was looking for something to stitch together for a particular use-case.

by indigodaddy

5/22/2025 at 12:39:45 PM

OK, that was my screwup, I'm sorry.

I saw your comment and didn't quite clock that you're not the author. Sorry about that. We've reversed the changes to make it a normal post again.

by tomhow

5/22/2025 at 2:24:19 PM

As nurettin said, I think I (unintentionally) made it too easy to connote that I might have been the author. I should have been more clear about it.

by indigodaddy

5/22/2025 at 5:07:27 AM

The confusion arises from your paragraph explaining what you made, then linking to a repo that contains the component you used. Why don't you show the thing that you made? An Ansible job sounds interesting.

by nurettin

5/22/2025 at 2:12:08 AM

[flagged]

by gnabgib

5/22/2025 at 4:25:28 PM

Just in case it's unclear: when we see someone submitting their own work, we often put Show HN in the title. But occasionally we misidentify the submitter as the author and do this incorrectly. That's what happened here. It's fixed now!

by dang

5/22/2025 at 2:13:13 AM

Eh? I'm not Derek.

by indigodaddy

5/22/2025 at 2:14:46 AM

[flagged]

by squigz

5/22/2025 at 2:17:44 AM

I didn't submit it as a show HN, and that description was originally just a comment that I had added some time later (an admin changed it to show HN and moved my comment to be the description)

by indigodaddy

5/22/2025 at 12:55:54 PM

Not for nothing, you could do this with Streamlit and 30 seconds of vibe coding.

you can also use Kanaries if you are looking for some more detailed "Tableau" like analytics platform.

by datax2

5/22/2025 at 2:31:44 PM

Why would you want to vibe code a whole python server setup when someone already made this that you can just plug and play? Id understand if you need a lot of different features, but to me this is neat and ticks a lot of boxes.

by indigodaddy