#!/bin/sh
file=`tempfile --prefix=xlsview --suffix=.html`
cat << EOT >$file
$1
EOT
xls2csv "$1" | while read line
do
echo "" >>$file
echo $line | awk -F, '{print "| " $1 " | " $2 " | " $3 " | " $4 " | " $5 " | " $6 " | " $7 " | " $8 " | " $9 " | " $10 " | " $11 " | " $12 " | " }' >>$file
echo "
" >>$file
done
echo "
" >>$file
#Try to open file in an existing netscape window
(netscape -remote "openFile(${file})") > /dev/null 2>&1 || rm $file
#if this fails, it means that netscape is not running, so start it
if [ $status ]; then
netscape -no-install file:${file}
fi