docs.sheetjs.com/tests/math/pandas.sh

40 lines
1012 B
Bash
Executable File

#!/bin/bash
# https://docs.sheetjs.com/docs/demos/math/pandas
OS=$(uname -s)
cd /tmp
rm -rf sheetjs-pandas
mkdir sheetjs-pandas
cd sheetjs-pandas
curl -LO https://duktape.org/duktape-2.7.0.tar.xz
tar -xJf duktape-2.7.0.tar.xz
cd duktape-2.7.0
make -f Makefile.sharedlibrary
cd ..
OS="$(uname -s)"
case "$OS" in
Darwin) LIB_NAME="libduktape.207.20700.so" ;;
Linux) LIB_NAME="libduktape.so.207.20700" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
cp "duktape-2.7.0/$LIB_NAME" .
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/shim.min.js
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -LO https://docs.sheetjs.com/pres.numbers
curl -LO https://docs.sheetjs.com/pandas/sheetjs.py
curl -LO https://docs.sheetjs.com/pandas/SheetJSPandas.py
sed "s#libduktape.207.20700.so#$LIB_NAME#g" sheetjs.py > sheetjs.py.tmp
mv sheetjs.py.tmp sheetjs.py
python3 SheetJSPandas.py pres.numbers || python SheetJSPandas.py pres.numbers
npx -y xlsx-cli SheetJSPandas.xlsb