Display any CSV file as a searchable, filterable, pretty HTML table
71 comments
·May 22, 2025waltbosz
> 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
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.
jayd16
Pwsh is actually pretty good.
My hottest of takes...Powershell is the easiest way to write consistent scripts across the big three OSes.
bblb
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.
majkinetor
Nah, that required IE which isn't available on Linux.
porridgeraisin
Does it write UTF16 on linux too? That's my biggest gripe with powershell redirections and Out-File's on windows.
greenmartian
In `pwsh` (that's the xplat version of powershell, v7+), default encoding for Out-File is `utf8noBOM`.
MstWntd
install tabview?..
tailspin2019
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…
szszrk
I guess there is consensus that powershell is good. Unix people may still find in cumbersome. For windows-primary people maybe it came too late? For a longer while it wasn't even integral part of Windows.
But honestly often when I talk to people they don't know the basics of cmd.exe, even if they worked with it for years. Like... surprised that it has pipes :) And apparently it's been there since DOS 2.0 (early 1980's).
tailspin2019
Good point about it coming too late. I grew up using Windows pre-powershell and then had switched to Macs by the time Powershell got a lot of improvements and became a lot more worthy of attention!
rahimnathwani
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.
razakel
They should really have called it PowerScript. It's the full blown .NET ecosystem.
34f34f3
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!
nathell
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).
ThrowawayTestr
Does that do the Excel thing where it crushes all the numbers to exponents?
bryanhogan
But does this include options for sorting and filtering?
ederderek
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!
o1nder
Loved the tool. Modified it so you can drag and drop CSV files in the browser instead of having to pull and run locally, and of course credited you. Hosted on Github Pages here (https://thomasinch.github.io/csv-to-html-table/), but made it a single index.html so it can be downloaded and used offline. Cheers!
indigodaddy
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!
RUnconcerned
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.
hilti
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.
1vuio0pswjnm7
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.
schwartzworld
That was my thought. Sqlite3+datasets works great for this
hk1337
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.
indigodaddy
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:
catapart
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.
hk1337
I was thinking just a table element with data attributes and maybe a class name.
catapart
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.
6510
I wrote this long ago. Looking at it I'm really a master spaghetti coder.
Propelloni
Spaghetti code is underrated.
mattsouth
Nice. Its interesting to me that searching and filtering isnt something that http://csvbase.com has.
indigodaddy
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.
strunz
Love this idea, wish I could pipe a CSV right to the tool though!
stevenpetryk
Could be easy enough to make a CLI tool that opens a browser to an HTML file in /tmp
promiseofbeans
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)
mokanfar
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.
Bimos
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.
hk1337
I was thinking of it as competition for GitHub’s CSV reader in repositories.
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!