Yeah it's a little bit hacky though. Let's start by installing two packages:
sudo apt-get install python-excelerator w3m
From there, we use a script that comes bundled with python-excelerator
to convert the document into a HTML file. We then pipe that into a command line browser (w3m
) and display it.
py_xls2html spreadsheet.xls 2>/dev/null | sed 's/"//g' | w3m -dump -T 'text/html'
You can create a bash function or alias with that if you don't want to keep typing it. It should give you output like this:
Sheet = Sheet1
┏━━━━┯━━━┯━━━━━┯━━━━━━━━━━━━┓
┃this│is │a │spreadsheet ┃
┠────┼───┼─────┼────────────┨
┃it │is │very │nice ┃
┠────┼───┼─────┼────────────┨
┃this│has│three│rows ┃
┗━━━━┷━━━┷━━━━━┷━━━━━━━━━━━━┛
Sheet = Sheet2 Sheet = Sheet3
Very pretteh. Obviously this isn't going to support any sort of macro, editing or any interactivity. This is purely a viewer. You could also work at stripping out the quotation marks that wrap things. I'm not particularly bothered by them at this point.
If you don't need it to be as tabular you could simply have something like this:
py_xls2csv spreadsheet.xls 2>&1 | less
You can go one further than that and display it in a slightly nicer way:
py_xls2csv spreadsheet.xls 2>&1 | grep '^"' | sed 's/"//g' | column -s, -t | less -#2 -N -S
That gives you the following:
1 this is a spreadsheet
2 it is very nice
3 this has three rows
That's probably a false positive. You can't do much about that, but you can circumvent it, by putting the document in a Zip archive using your favourite archive manager.
Some malware scanners peek into archives too, in which case you need to encrypted your archive and send the password along with it.
Best Answer
There is a tool called
odt2txt
that can convertodt
totxt
.Compared to libreoffice I can see two benefits:
Installation:
Then you can directly view an
odt
: