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

github.com

261 points by indigodaddy 3 days ago


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!

waltbosz - 2 days ago

> 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.

szszrk - 2 days ago

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.

34f34f3 - 2 days ago

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!

ederderek - 2 days ago

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!

1vuio0pswjnm7 - 2 days ago

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.

RUnconcerned - 2 days ago

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/

indigodaddy - 3 days ago

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!

hk1337 - 2 days ago

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.

mattsouth - 2 days ago

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

6510 - 2 days ago

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

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

strunz - 3 days ago

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

promiseofbeans - 3 days ago

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)

sn0n - 2 days ago

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

neilv - 3 days ago

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>";
pphysch - 3 days ago

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

bryanhogan - 2 days ago

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.

65 - 2 days ago

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.

nashashmi - 2 days ago

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?

davidcollantes - 2 days ago

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

magesh_magi1 - 2 days ago

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

CommenterPerson - 2 days ago

Nice work! Immediately usable.

joseangel_sc - 2 days ago

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

cbeach - 2 days ago

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

indigodaddy - 3 days ago

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.

datax2 - 2 days ago

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.