xref: /plan9/rc/bin/xls2txt (revision 2009dc88df672c2a416b2d1e1e9b7b5bedb3ce4e)
1#!/bin/rc
2
3rfork en
4
5if(! ~ $#* 0 1) {
6	echo 'usage: xls2txt [file.xls]' >[1=2]
7	exit usage
8}
9
10switch($#*){
11case 0
12	cat >/tmp/xls2txt.$pid
13	file=/tmp/xls2txt.$pid
14case 1
15	file=$1
16}
17aux/olefs $file || {
18	echo 'xls2txt: couldn''t mount excel document' >[1=2]
19	rm -f /tmp/xls2txt.$pid
20	exit word
21}
22
23if(! test -f /mnt/doc/Workbook) {
24	echo 'xls2txt: is an MSoffice doc but not an Excel document' >[1=2]
25	rm -f /tmp/xls2txt.$pid
26	exit wordxls
27}
28
29aux/msexceltables /mnt/doc/Workbook
30unmount /mnt/doc
31rm -f /tmp/xls2txt.$pid
32
33