forked from sheetjs/docs.sheetjs.com
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			900 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			900 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| # https://docs.sheetjs.com/docs/demos/data/postgresql
 | |
| ## NOTE: these steps are for darwin-arm
 | |
| 
 | |
| cd /tmp
 | |
| mkdir sheetjs-pg
 | |
| cd sheetjs-pg
 | |
| npm init -y
 | |
| npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz pg@8.13.1 pg-format@1.0.4
 | |
| 
 | |
| curl -LO https://docs.sheetjs.com/postgresql/SheetJSPG.js
 | |
| curl -L -O https://docs.sheetjs.com/pres.numbers
 | |
| 
 | |
| for n in 1{2..7}; do
 | |
| 	# brew install postgresql@$n
 | |
| 	echo $n
 | |
| 
 | |
| 	# "If you need to have postgresql@$n first in your PATH, run:"
 | |
| 	export PATH="/opt/homebrew/opt/postgresql@$n/bin:$PATH"
 | |
| 
 | |
| 	# "Or, if you don't want/need a background service you can just run:"
 | |
| 	nohup env LC_ALL="C" /opt/homebrew/opt/postgresql@$n/bin/postgres -D /opt/homebrew/var/postgresql@$n >/dev/null 2>&1 &
 | |
| 	sleep 5
 | |
| 
 | |
| 	dropdb SheetJSPG
 | |
| 	createdb SheetJSPG
 | |
| 
 | |
| 	node SheetJSPG.js
 | |
| 	npx xlsx-cli SheetJSPGExport.xlsx
 | |
| 	psql SheetJSPG -c 'SELECT * FROM "Presidents";'
 | |
| 
 | |
| 	kill $!
 | |
| done
 | |
| 
 |