#!/usr/bin/env pwsh # https://docs.sheetjs.com/docs/demos/engines/v8#python $oldDir = Get-Location $tempDir = Join-Path -Path $env:TEMP -ChildPath "sheetjs-miniracer" if (Test-Path -Path $tempDir) { Remove-Item -Path $tempDir -Recurse -Force } New-Item -ItemType Directory -Path $tempDir | Out-Null Set-Location -Path $tempDir pip install mini-racer 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { python -m pip install mini-racer } Invoke-WebRequest -Uri "https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js" -OutFile "xlsx.full.min.js" Invoke-WebRequest -Uri "https://docs.sheetjs.com/pres.xlsx" -OutFile "pres.xlsx" Invoke-WebRequest -Uri "https://docs.sheetjs.com/v8/sheetjs-mini-racer.py" -OutFile "sheetjs-mini-racer.py" python sheetjs-mini-racer.py pres.xlsx if ($LASTEXITCODE -ne 0) { throw "Python script failed" } npm init -y npm i --save xlsx-cli .\node_modules\.bin\xlsx-cli SheetJSMiniRacer.xlsb Set-Location $oldDir Remove-Item -Path $tempDir -Recurse -Force