24

Does such a thing exist? Text-based spreadsheets that display well in a CLI environment. I'm aware that I could cat foobar.csvand do as I please, but it isn't particularly practical or attractive. I cannot imagine it would be hard to format a table, and maybe follow certain rules (math?) as well.

Emacs has org-mode which handles text-based tables quite well, and allows exporting to multiple formats. However, one must use Emacs! Which as a Vim user I would prefer to avoid.

7
  • What is not practical or attractive? Do you need to use formulars, do you like to do interactive inserts? What do you need? Nov 9 '11 at 16:39
  • @userunknown The readability of comma or tab separated values clearly suffers unless each value is of same width as all others.
    – Sergey
    Nov 9 '11 at 17:59
  • 1
    are you looking for read-write access to spreadsheets, or read-only access? Nov 9 '11 at 21:51
  • @TimKennedy Ideally something that can replace Excel for basic tasks, but something that can output a spreadsheet with decent formatting would be great.
    – Sergey
    Nov 10 '11 at 17:10
  • @Sergey: Well - the readability is fine if you use tabs, and all values fall into the same length-range in multiples of 8, to be a bit more precise. Tabs where invented for this purpose. Nov 10 '11 at 19:09
15

There's sc and oleo (neither of which I have any experience with). Being a GNU project, however, oleo's handling is more likely to be emacsesque than vimmy.

2
  • 6
    According to the article I linked to, sc looks much more vimmy than oleo does.
    – cjm
    Nov 9 '11 at 7:47
  • I just gave sc a try. It doesn't seem to play well with screen, at least for me. I will give it some more time and see if I can deal with it. vi navigation, so far, is a blessing.
    – Sergey
    Nov 10 '11 at 17:11
3

There's also slsc that is based on sc but with a friendlier user interface.

However it has as dependency libslang1 that is not actively developed (libslang2 is the current developed version) so the program itself is no longer developed.

Me and my piano teacher are planning to port it to libslang2 in order to see it back in repositories. :)

1
  • 4
    You and your piano teacher, huh? How's that going?
    – Kazark
    Mar 22 '13 at 23:03
3

I use and recommend visidata.

It plays well with the shell – e.g. you can stick it at the end of your pipe. If

bzcat foo.bz2|sort|uniq -c|sort -nr | awk -f munge.awk |blah

produces a tsv, then

bzcat foo.bz2|sort|uniq -c|sort -nr | awk -f munge.awk |blah|vd

makes that tsv into an interactive (if you think ncurses is interactive) spreadsheet with plotting and pivot tables and mouse support :)

visidata histogram, press shift-F

You can add columns with Python expressions referring to other columns, or extend it with plugins. You can diff two csv's.

You can also save your keypresses in vd to a file and then re-run them at a later stage – I've got some scripts to re-run an analysis and then run vd on it and immediately set all columns to floats and open the frequency table so I can see if I managed to lower the median this time.

The docs and tutorials from the home page are pretty good, but if you learn better by watching than reading, there's a series of visdata youtube tutorials and showcases by the author.

1

There is an Org-Mode port to Vim.

2
  • Can you add more detail?
    – Kazark
    Mar 22 '13 at 23:02
  • @Kazark: Thanks for cleaning up my link! The original question indicated familiarity with Org Mode, particularly with Org Mode's Spreadsheet, but was not enthusiastic about Emacs. I wanted to share the Vim alternative. Mar 30 '13 at 19:15
0

If you can find an old dos spread sheet ( for example 1-2-3 ), you should be able to run it via dosemu.

Bluntly if you search the web for downloadable dos spreadsheets you would find what I call "I-don't-care-ware." Stuff that it would be technically unlawful to download, but generally the copyright holder doesn't care.

One which you would be safe to try is VisiCalc.

0

There is a Vim script called Spreadsheet.vim (and on github). From the description section of the linked page:

This script lets you use vim as a spreadsheet, adding arithmetic calculations to your text files.

Useful for bills, expenses, ratings and other numeric text templates.

It provides three main functions:

Get("cell")
Set("cell", "value")
Calculate("operation")

Detailed instructions and examples are included in the script file.

I have not yet compared this to the solutions mentioned by others. I suspect it has the disadvantage of not being as powerful as a specific spreadsheet program in some ways; but since it lets you use Vim itself, you receive another kind of powerful proportional to the greatness of your Vimfoo.

One caveat is that it does not seem very portable:

It uses 'bc' Linux OS comand for the Calculate function.

However, since you asked this on U&L.SE, maybe that is not a problem for you.

1
  • I tried this on Windows and yes, I ran into the 'bc' issue. Even if this did work, from what I can tell, this is extremely verbose and limited in terms of what it can do. It's more like adding math in a horribly verbose manner to Vim than doing anything like a spreadsheet.
    – horta
    Aug 25 '16 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.