Skip to main content
Ungathered Thoughts

Visidata, a CLI powertool for CSV

I've been messing around with spreadsheets a little more than usual the last week or two, and popping between shell environment and a spreadsheet was making me feel like I was shifting gears noisily. Spreadsheets are amazing tools, but when I'm happy building in some kind of flow, switching in and out of spreadsheet interface harshes my buzz. My IDE meanwhile: great at many things, but not tabular data.

I decided to give Visidata a spin, and found it delivered what I wanted - a quick, terminal-based editing interface to the tabular data world that didn't feel like too much of a shift from the shell. I had to look up the command basics, but that was not dissimilar to when I'm using a regular spreadsheet - I'm an infrequent visitor!

Soon enough I found an Interesting Task. I wanted to add an additional column filled with UUIDs, so that I could create content entities with a known reference and then round trip data in and out of the CSV. With Visidata, I was delighted to find I could use familiar UNIX tools to add myself a column of UUID to a CSV. My favourite solution the one I found in Visidata's help:

z; expr  create new column from bash expr, with $columnNames as variables

I entered z; then uuidgen, and Visidata added two new columns: uuidgen stdout (filled with UUIDs) and uuidgen stderr (empty). I renamed uuidgen stdout (select, ^, enter new value) and deleted the additional column (select, - I think?) and was on my way.

Nice and easy. Visidata looks like a great tool - will definitely keep it available, as it seems like it has a ton of potential for slicing and dicing data in this format and many more. Looking forward to exploring more!

Fond memories of my Mum using Visicalc on a TRS-80 ...

  1. A UUID generation function is available in both LibreOffice Calc (=GUID()) and Google Sheets (=UUID()).
  2. for ii in $( seq 20 ); do uuidgen ; done, copying the output and pasting into a blank column works fine too.