docs.sheetjs.com/tests/data/mariadb.sh

34 lines
927 B
Bash
Raw Normal View History

2026-03-23 06:38:17 +00:00
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/data/mariadb
## NOTE: these steps are for darwin-arm
cd /tmp
mkdir sheetjs-mariadb
cd sheetjs-mariadb
npm init -y
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz mysql2@latest
curl -LO https://docs.sheetjs.com/mariadb/SheetJSMariaDB.js
curl -L -O https://docs.sheetjs.com/pres.numbers
for n in 10.6 11.8; do
# brew install mariadb@$n
echo $n
# "If you need to have mariadb@$n first in your PATH, run:"
export PATH="/opt/homebrew/opt/mariadb@$n/bin:$PATH"
# "Or, if you don't want/need a background service you can just run:"
mysqld_safe --skip-grant-tables &
sleep 5
mysql -u root -e 'DROP DATABASE IF EXISTS SheetJSMariaDB;'
mysql -u root -e 'CREATE DATABASE SheetJSMariaDB;'
node SheetJSMariaDB.js
npx xlsx-cli SheetJSMariaDBExport.xlsx
mysql -u root SheetJSMariaDB -e 'SELECT * FROM Presidents;'
killall mysqld 2>/dev/null
sleep 2
done