Demo refresh

This commit is contained in:
SheetJS 2025-02-16 23:49:35 -05:00
parent d3e0baa6bb
commit fd19686365
48 changed files with 698 additions and 221 deletions

@ -122,11 +122,11 @@ This demo was last tested in the following deployments:
| Architecture | BunJS | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `1.1.39` | 2024-12-17 |
| `darwin-arm` | `1.1.10` | 2024-09-22 |
| `darwin-arm` | `1.2.2` | 2025-02-16 |
| `win11-x64` | `1.1.42` | 2024-12-22 |
| `win11-arm` | `1.1.40` | 2024-12-19 |
| `linux-x64` | `1.1.40` | 2024-12-19 |
| `linux-arm` | `1.1.40` | 2024-12-19 |
| `linux-arm` | `1.2.2` | 2025-02-16 |
BunJS on Windows on ARM uses the X64 compatibility layer.

@ -45,7 +45,7 @@ This demo was tested in the following deployments:
| `win11-x64` | Duktape `2.7.0` | 2.2.3 | 3.11.8 | 2024-12-21 |
| `win11-arm` | Duktape `2.7.0` | 2.2.2 | 3.11.5 | 2024-06-20 |
| `linux-x64` | Duktape `2.7.0` | 1.5.3 | 3.11.7 | 2025-01-01 |
| `linux-arm` | Duktape `2.7.0` | 1.5.3 | 3.11.2 | 2024-06-20 |
| `linux-arm` | Duktape `2.7.0` | 1.5.3 | 3.11.2 | 2025-02-16 |
:::
@ -231,8 +231,16 @@ When `pip` is not installed, the command will fail:
/usr/bin/python3: No module named pip
```
`pip` must be installed. On Arch Linux-based platforms including the Steam Deck,
`python-pip` can be installed through the package manager:
`pip` must be installed.
In Debian Linux, `pip` can be installed through the package manager:
```bash
sudo apt-get install pip
```
On Arch Linux-based platforms including the Steam Deck, `python-pip` can be
installed through the package manager:
```bash
sudo pacman -Syu python-pip
@ -524,7 +532,7 @@ This demo was tested in the following deployments:
| `win11-x64` | Duktape `2.7.0` | 1.17.1 | 3.11.8 | 2024-12-21 |
| `win11-arm` | Duktape `2.7.0` | 0.20.31 | 3.11.5 | 2024-06-20 |
| `linux-x64` | Duktape `2.7.0` | 1.18.0 | 3.11.7 | 2025-01-01 |
| `linux-arm` | Duktape `2.7.0` | 0.20.31 | 3.11.2 | 2024-06-20 |
| `linux-arm` | Duktape `2.7.0` | 1.22.0 | 3.11.2 | 2025-02-16 |
:::
@ -608,7 +616,7 @@ through the Visual Studio installer.
:::caution pass
On Arch Linux-based platforms including the Steam Deck, the install may fail:
In some local tests, the install failed with the following error:
```
error: externally-managed-environment
@ -616,6 +624,8 @@ error: externally-managed-environment
It is recommended to use a virtual environment.
---
`venv` must be installed through the system package manager:
- Debian and Ubuntu distributions:
@ -632,6 +642,8 @@ sudo apt-get install python3.11-venv
brew install pyenv-virtualenv
```
---
After installing `venv`, the following commands set up the virtual environment:
```bash

@ -448,9 +448,9 @@ export default function SheetJSKaiokenAoO() {
This demo was tested in the following environments:
| Kaioken | ViteJS | Date |
|:---------|:---------|:-----------|
| `0.17.0` | `5.2.11` | 2024-05-21 |
| Kaioken | ViteJS | Date |
|:----------|:--------|:-----------|
| `0.35.10` | `6.1.0` | 2025-02-11 |
:::
@ -554,7 +554,7 @@ import { read, utils, writeFileXLSX } from 'xlsx';
export default function SheetJSKaiokenHTML() {
/* the ref is used in export */
const tbl = useRef<Element>(null);
const tbl = useRef<HTMLDivElement>(null);
/* Fetch and update the state once */
useEffect(() => { (async() => {
@ -595,9 +595,9 @@ export default function SheetJSKaiokenHTML() {
This demo was tested in the following environments:
| Kaioken | ViteJS | Date |
|:---------|:---------|:-----------|
| `0.17.0` | `5.2.11` | 2024-05-21 |
| Kaioken | ViteJS | Date |
|:----------|:--------|:-----------|
| `0.35.10` | `6.1.0` | 2025-02-11 |
:::

@ -359,7 +359,7 @@ This demo was tested in the following environments:
| VueJS | ViteJS | Date |
|:---------|:---------|:-----------|
| `3.4.27` | `5.2.11` | 2024-05-26 |
| `3.5.13` | `6.1.0` | 2025-02-15 |
:::

@ -377,7 +377,7 @@ This demo was tested in the following deployments:
| `win11-x64` | 0.1.48 | 2.0.4 | 2024-10-30 |
| `win11-arm` | 0.1.48 | 2.0.4 | 2024-10-30 |
| `linux-x64` | 0.1.48 | 2.0.5 | 2025-01-10 |
| `linux-arm` | 0.1.48 | 2.0.4 | 2024-10-30 |
| `linux-arm` | 0.1.48 | 2.1.10 | 2025-02-16 |
:::

@ -209,10 +209,10 @@ This demo was tested in the following environments:
|:---------------|:-------------|:---------|:-----------|
| macOS 15.2 | `darwin-x64` | `33.2.1` | 2024-12-31 |
| macOS 14.5 | `darwin-arm` | `30.0.8` | 2024-05-28 |
| Windows 11 | `win11-x64` | `33.2.1` | 2025-01-19 |
| Windows 11 | `win11-x64` | `33.2.1` | 2025-02-11 |
| Windows 11 | `win11-arm` | `30.0.8` | 2024-05-28 |
| Linux (HoloOS) | `linux-x64` | `33.2.1` | 2025-01-02 |
| Linux (Debian) | `linux-arm` | `30.0.8` | 2024-05-28 |
| Linux (Debian) | `linux-arm` | `33.2.1` | 2025-02-16 |
:::
@ -389,4 +389,4 @@ Electron 14 and later must use `@electron/remote` instead of `remote`. An
:::
[^1]: See ["Makers"](https://www.electronforge.io/config/makers) in the Electron Forge documentation. On Linux, the demo generates `rpm` and `deb` distributables. On Arch Linux and the Steam Deck, `sudo pacman -Syu rpm-tools dpkg fakeroot` installed required packages.
[^1]: See ["Makers"](https://www.electronforge.io/config/makers) in the Electron Forge documentation. On Linux, the demo generates `rpm` and `deb` distributables. On Arch Linux and the Steam Deck, `sudo pacman -Syu rpm-tools dpkg fakeroot` installed required packages. On Debian and Ubuntu, `sudo apt-get install rpm` sufficed.

@ -1,5 +1,6 @@
---
title: NW.js
title: Sheets in NW.js
sidebar_label: NW.js
pagination_prev: demos/mobile/index
pagination_next: demos/cli/index
sidebar_position: 2
@ -12,10 +13,14 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone)
can be referenced in a `SCRIPT` tag from the entry point HTML page.
[NW.js](https://nwjs.io/), formerly `node-webkit`, is a modern toolkit for
building desktop apps using web technologies.
The "Complete Example" creates an app that looks like the screenshots below:
[SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing
data from spreadsheets.
The ["Complete Example"](#complete-example) section covers a complete desktop
app to read and write workbooks. The app will look like the screenshots below:
<table><thead><tr>
<th><a href="#complete-example">Windows</a></th>
@ -37,6 +42,9 @@ The "Complete Example" creates an app that looks like the screenshots below:
## Integration Details
The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone)
can be referenced in a `SCRIPT` tag from the entry point HTML page.
NW.js provides solutions for reading and writing files.
### Reading Files
@ -118,7 +126,7 @@ This demo was tested in the following environments:
| Windows 11 | `win11-x64` | `0.94.0` | 2024-12-19 | |
| Windows 11 | `win11-arm` | `0.88.0` | 2024-05-28 | |
| Linux (HoloOS) | `linux-x64` | `0.89.0` | 2025-01-10 | |
| Linux (Debian) | `linux-arm` | `0.60.0` | 2024-05-23 | Unofficial build[^1] |
| Linux (Debian) | `linux-arm` | `0.60.0` | 2025-02-16 | Unofficial build[^1] |
:::
@ -179,6 +187,24 @@ table will refresh with the contents of the selected file.
Click "Export Data!" and save the generated file to `SheetJSNWDemo.xlsx`. This
file can be opened in Excel or another spreadsheet editor.
<details>
<summary><b>Linux ARM64 support</b> (click to show)</summary>
NW.js does not officially support `linux-arm`. The official recommendation is to
use a third-party pre-built version.
```bash
curl -LO https://github.com/LeonardLaszlo/nw.js-armv7-binaries/releases/download/nw60-arm64_2022-01-08/nw60-arm64_2022-01-08.tar.gz
tar -xzf nw60-arm64_2022-01-08.tar.gz
cp usr/docker/dist/nwjs-chromium-ffmpeg-branding/nwjs-v0.60.1-linux-arm64.tar.gz
tar -xzf nwjs-v0.60.1-linux-arm64.tar.gz
./nwjs-v0.60.1-linux-arm64/nw .
```
Unfortunately `nw-builder` will not be able to build a standalone program.
</details>
5) To build a standalone app, run the builder:
```bash

@ -302,7 +302,7 @@ This demo was tested in the following environments:
| Windows 11 | `win11-x64` | `v2.9.2` | 2024-12-21 |
| Windows 11 | `win11-arm` | `v2.8.2` | 2024-05-28 |
| Linux (HoloOS) | `linux-x64` | `v2.9.2` | 2025-01-02 |
| Linux (Debian) | `linux-arm` | `v2.8.2` | 2024-05-28 |
| Linux (Debian) | `linux-arm` | `v2.10` | 2025-02-16 |
:::

@ -358,7 +358,7 @@ This demo was tested in the following environments:
| Windows 11 | `win11-x64` | `v1.6.0` | 2024-12-21 |
| Windows 11 | `win11-arm` | `v1.5.14` | 2024-05-28 |
| Linux (HoloOS) | `linux-x64` | `v1.6.0` | 2025-01-02 |
| Linux (Debian) | `linux-arm` | `v1.5.14` | 2024-05-28 |
| Linux (Debian) | `linux-arm` | `v1.6.0` | 2025-02-16 |
:::
@ -611,7 +611,7 @@ If the build fails, see ["Troubleshooting"](#troubleshooting) for more details.
Depending on the version of Tauri, the command may be
```bash
./src-tauri/target/release/SheetJSTauri
./src-tauri/target/release/sheetjstauri
```
or
@ -623,7 +623,7 @@ or
or
```bash
./src-tauri/target/release/sheetjstauri
./src-tauri/target/release/SheetJSTauri
```
</TabItem>

@ -197,7 +197,7 @@ This demo was tested in the following environments:
| Windows 11 | `win11-x64` | `5.5.0` | `5.5.0` | 2024-12-20 |
| Windows 11 | `win11-arm` | `5.1.0` | `5.1.1` | 2024-05-28 |
| Linux (HoloOS) | `linux-x64` | `5.5.0` | `5.5.0` | 2025-01-02 |
| Linux (Debian) | `linux-arm` | `5.1.0` | `5.1.1` | 2024-05-28 |
| Linux (Debian) | `linux-arm` | `5.6.0` | `5.6.0` | 2025-02-16 |
NeutralinoJS on Windows on ARM generates X64 binaries that run using the X64
compatibility layer. The binaries are not native ARM64 programs!

@ -38,11 +38,11 @@ This demo was tested in the following deployments:
| Architecture | Version | NodeJS | Source | Date |
|:-------------|:-------------|:----------|:----------|:-----------|
| `darwin-x64` | `4.0.0-rc.6` | `14.15.3` | Pre-built | 2025-01-19 |
| `darwin-arm` | `4.0.0-rc.6` | `18.20.3` | Compiled | 2024-05-25 |
| `darwin-arm` | `4.0.0-rc.6` | `20.18.0` | Compiled | 2025-02-13 |
| `win11-x64` | `4.0.0-rc.6` | `14.15.3` | Pre-built | 2024-12-19 |
| `win11-arm` | `4.0.0-rc.6` | `20.10.0` | Compiled | 2024-05-28 |
| `linux-x64` | `4.0.0-rc.6` | `14.15.3` | Pre-built | 2024-12-31 |
| `linux-arm` | `4.0.0-rc.6` | `18.20.3` | Compiled | 2024-05-26 |
| `linux-arm` | `4.0.0-rc.6` | `22.13.0` | Compiled | 2025-02-15 |
:::
@ -96,7 +96,7 @@ yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz exit-on-epi
3) Create the standalone program:
```bash
npx nexe -t 14.15.3 xlsx-cli.js
npx -y nexe -t 14.15.3 xlsx-cli.js
```
<details open>
@ -109,7 +109,7 @@ missing. For unsupported NodeJS versions, packages must be built from source:
<TabItem value="unix" label="Linux/MacOS">
```bash
npx nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"
npx -y nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"
```
</TabItem>
@ -118,13 +118,13 @@ npx nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"
On Windows x64, the `--build` flag suffices:
```bash
npx nexe xlsx-cli.js --build --make="-j8"
npx -y nexe xlsx-cli.js --build --make="-j8"
```
On Windows ARM, the target `windows-arm64-20.10.0` must be specified:
```bash
npx nexe xlsx-cli.js --build --make="-j8" --target=windows-arm64-20.10.0
npx -y nexe xlsx-cli.js --build --make="-j8" --target=windows-arm64-20.10.0
```
**`vcbuild.bat` issues**

@ -38,11 +38,11 @@ This demo was tested in the following deployments:
| Architecture | Version | NodeJS | Date |
|:-------------|:--------|:---------|:-----------|
| `darwin-x64` | `5.8.1` | `18.5.0` | 2025-01-19 |
| `darwin-arm` | `5.8.1` | `18.5.0` | 2024-05-25 |
| `darwin-arm` | `5.8.1` | `18.5.0` | 2025-02-13 |
| `win11-x64` | `5.8.1` | `18.5.0` | 2024-12-19 |
| `win11-arm` | `5.8.1` | `18.5.0` | 2024-10-25 |
| `linux-x64` | `5.8.1` | `18.5.0` | 2024-12-31 |
| `linux-arm` | `5.8.1` | `18.5.0` | 2024-05-26 |
| `linux-arm` | `5.8.1` | `18.5.0` | 2025-02-15 |
:::

@ -31,10 +31,10 @@ This demo was tested in the following deployments:
| Architecture | Version | NodeJS | Date |
|:-------------|:--------|:----------|:-----------|
| `darwin-x64` | `2.4.4` | `23.6.0` | 2025-01-19 |
| `darwin-arm` | `2.4.3` | `22.2.0` | 2024-05-25 |
| `darwin-arm` | `2.4.4` | `23.7.0` | 2025-02-11 |
| `win11-x64` | `2.4.4` | `16.20.2` | 2024-12-19 |
| `linux-x64` | `2.4.4` | `23.5.0` | 2024-12-31 |
| `linux-arm` | `2.4.3` | `20.13.1` | 2024-05-26 |
| `linux-arm` | `2.4.4` | `23.8.0` | 2025-02-15 |
:::
@ -94,9 +94,9 @@ yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz exit-on-epi
npx boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli
```
:::caution pass
:::note pass
When this demo was last tested in `linux-arm`, the build failed with an error:
In previous `linux-arm` test runs, the build failed with an error:
<pre>
../deps/v8/src/base/small-vector.h: In instantiation of <span {...B}>class v8::base::SmallVector&lt;std::pair&lt;const v8::internal::compiler::turboshaft::PhiOp*, const v8::internal::compiler::turboshaft::OpIndex&gt;, 16&gt;</span>:
@ -106,14 +106,14 @@ When this demo was last tested in `linux-arm`, the build failed with an error:
{" |"} ^~~~~
</pre>
This affects NodeJS `22.2.0`, but does not affect `20.13.1`. It affects the
[V8 JavaScript Engine](/docs/demos/engines/v8#build-v8).
This affects NodeJS `22.2.0`, but does not affect `20.13.1` or `23.8.0`. It also
affects the [V8 JavaScript Engine](/docs/demos/engines/v8#build-v8).
The `-n` flag controls the target NodeJS version. For this demo, the following
command uses NodeJS `20.13.1`:
command uses NodeJS `23.8.0`:
```bash
npx boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli -n 20.13.1
npx boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli -n 23.8.0
```
:::

@ -159,11 +159,11 @@ This demo was tested in the following deployments:
| Architecture | NodeJS | Date |
|:-------------|:----------|:-----------|
| `darwin-x64` | `22.13.0` | 2025-01-19 |
| `darwin-arm` | `22.2.0` | 2024-05-29 |
| `darwin-arm` | `23.8.0` | 2025-02-16 |
| `win11-x64` | `22.13.0` | 2025-01-19 |
| `win11-arm` | `20.14.0` | 2024-06-11 |
| `linux-x64` | `22.12.0` | 2025-01-02 |
| `linux-arm` | `20.14.0` | 2024-06-10 |
| `linux-arm` | `22.13.0` | 2025-02-16 |
:::

@ -80,11 +80,11 @@ This demo was last tested in the following deployments:
| Architecture | BunJS | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `1.1.45` | 2025-01-19 |
| `darwin-arm` | `1.1.40` | 2024-12-19 |
| `darwin-arm` | `1.2.2` | 2025-02-16 |
| `win11-x64` | `1.1.40` | 2024-12-19 |
| `win11-arm` | `1.1.33` | 2024-10-25 |
| `linux-x64` | `1.1.43` | 2025-01-10 |
| `linux-arm` | `1.1.12` | 2024-06-10 |
| `linux-arm` | `1.2.2` | 2025-02-16 |
:::

@ -100,11 +100,11 @@ This demo was last tested in the following deployments:
| Architecture | Deno | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `2.1.6` | 2025-01-19 |
| `darwin-arm` | `1.43.6` | 2024-05-23 |
| `darwin-arm` | `2.1.10` | 2025-02-13 |
| `win11-x64` | `2.1.6` | 2025-01-19 |
| `win11-arm` | `2.0.3` | 2024-10-25 |
| `linux-x64` | `2.1.4` | 2025-01-02 |
| `linux-arm` | `1.43.6` | 2024-05-25 |
| `linux-arm` | `2.1.10` | 2025-02-15 |
:::

@ -109,9 +109,9 @@ Typically this file is stored in the app folder.
For example, if the app is named `sheetjs_demo_app`, the entrypoint HTML file is
`webApps/sheetjs_demo_app/index.html`.
The script should be added before the Oracle JET and VB scripts:
The script should be added in the `HEAD` block:
<CodeBlock language="html" value="html" title="index.html (add in the HEAD block before Oracle scripts)">{`\
<CodeBlock language="html" value="html" title="index.html (add in the HEAD block)">{`\
<script src="https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js"></script>
`}
</CodeBlock>
@ -119,14 +119,26 @@ The script should be added before the Oracle JET and VB scripts:
This will expose the `XLSX` global object, which includes the functions listed
in the ["API Reference"](/docs/api/) section of the documentation.
:::note pass
## Internal State
The Visual Builder scripts are injected at `<!-- visualBuilderScripts -->`. This
comment is typically in the `BODY` block:
The various SheetJS APIs work with various data shapes. The preferred state
depends on the application.
```html title="index.html (base template)"
<body class="oj-web-applayout-body vb-web-applayout-body">
<oj-vb-content config="[[vbApplication]]"></oj-vb-content>
### Business Objects
<!-- highlight-next-line -->
<!-- visualBuilderScripts -->
```
Adding the SheetJS Standalone script to the `HEAD` block ensures the script will
be processed before loading Oracle Visual Builder scripts.
:::
## Business Objects
`Business Objects`[^2] in Oracle VBS provides a server-side model implementation
for persistent data storage.
@ -134,41 +146,47 @@ for persistent data storage.
Think of them as a combination of a data model and database table that handles both data storage and
UI binding.
#### Business Object Definition
### Business Object Definition
The example [presidents sheet](https://docs.sheetjs.com/pres.xlsx) has one header row with "Name" and "Index"
columns. In Oracle VBS, we model this as a Business Object with corresponding fields:
#### Schema
The example [presidents sheet](https://docs.sheetjs.com/pres.xlsx) has a header
row with "Name" and "Index" columns. In Oracle VBS, we model this as a Business
Object with two fields.
Fields in Business Objects must have a specified type. A sample business object
definition for the following schema is shown below:
| Field Label | Type | Field ID |
|:------------|:---------|:---------|
| Name | `string` | `name` |
| Index | `number` | `index1` |
```json title="Sample Business Object Definition"
{ "items" : [ {
"name": "Pres",
"fields": {
"name": { "type": "string", "label": "Name" },
"index1": { "type": "number", "label": "Index" }
}
} ] }
```
#### Data
Actions can query data from the Business Object with REST calls. The `items`
property of the response is an array of objects.
Fields are identified by Field ID. The field names do not appear in the result.
<table>
<thead><tr><th>Spreadsheet</th><th>Business Object Definition</th></tr></thead>
<thead><tr><th>Spreadsheet</th><th>Query Result</th></tr></thead>
<tbody><tr><td>
![`pres.xlsx` data](pathname:///pres.png)
</td><td>
```json
{
"items" : [ {
"name": "Pres",
"fields": {
"name": {
"type": "string",
"label": "Name"
},
"index1": {
"type": "number",
"label": "Index"
}
}
}]
}
```
</td></tr></tbody></table>
Here is how the data is represented when queried from the Business Object via REST call:
```json
{
"items": [
@ -181,6 +199,8 @@ Here is how the data is represented when queried from the Business Object via RE
}
```
</td></tr></tbody></table>
#### Updating Business Object
Starting from a spreadsheet file, the SheetJS [`read`](/docs/api/parse-options) method parses the data into a workbook object. After
@ -192,44 +212,46 @@ Here is a sample flow diagram and method for downloading a workbook, generating
```mermaid
flowchart LR
xlsx[(Remote\nFile)]
bo1[(Data\nArrayBuffer)]
ab[(Data\nArrayBuffer)]
wb(SheetJS\nWorkbook)
ws(SheetJS\nWorksheet)
json(JSON\nData)
bo2[(Business\nObject)]
bo[(Business\nObject)]
xlsx --> |fetch\n\n| bo1
bo1 --> |XLSX.read\n\n| wb
xlsx --> |fetch\n\n| ab
ab --> |`read`\n\n| wb
wb --> |wb.Sheets\nselect| ws
ws --> |sheet_to_json\n\n| json
json --> |REST API\ncreate| bo2
ws --> |`sheet_to_json`\n\n| json
json --> |REST API\ncreate| bo
linkStyle 1,2,3 color:blue,stroke:blue;
```
<CodeBlock language="javascript" value="javascript" title="Download workbook, extract data from first worksheet, and update ">{`
<CodeBlock language="javascript" value="javascript" title="Download workbook, extract data from first worksheet, and upload">{`\
define(['vb/action/actionChain', 'vb/action/actions', 'xlsx'], (ActionChain, Actions, XLSX) => {
class ButtonActionChain extends ActionChain {
async run(context) {
// fetch XLSX file
const data = await (await fetch("https://docs.sheetjs.com/pres.xlsx")).arrayBuffer();
/* fetch spreadsheet file */
const url = "https://docs.sheetjs.com/pres.xlsx";
const data = await (await fetch(url)).arrayBuffer();
/* parse */
const wb = XLSX.read(data);
// get the first worksheet
/* convert the first worksheet to json */
const ws = wb.Sheets[wb.SheetNames[0]];
// convert to json
const jsonData = XLSX.utils.sheet_to_json(ws);
// process each row and create business object records
for (const row of jsonData) {
const presData = {
name: row.Name,
index1: Number(row.Index)
};
for (const row of jsonData) { // loop over data rows
/* create object that follows business object definition */
const presData = {
name: row.Name,
index1: Number(row.Index)
};
// update business object with new record
await Actions.callRest(context, {
endpoint: 'businessObjects/create_Pres',
body: presData
});
/* update business object with new record */
await Actions.callRest(context, {
endpoint: 'businessObjects/create_Pres',
body: presData
});
}
}
}
@ -239,6 +261,7 @@ flowchart LR
</CodeBlock>
#### Rendering Data
In Oracle VBS, the table component `oj-table` supports direct binding to Business Objects for data display.
The view structure defines both the data source binding and column layout:
@ -261,7 +284,8 @@ The following example uses the `Table`[^4] component to display data.
</CodeBlock>
#### Exporting Data
#### Exporting Business Objects
The export functionality converts Business Object data into an Excel spreadsheet. The process involves retrieving data through
REST API call, transforming it into a format suitable for SheetJS, and generating an XLSX file. Here's the complete flow:
@ -322,7 +346,8 @@ deployment process automatically.
:::
## Importing Data {#importing-data-snippet}
### Importing Data {#importing-data-snippet}
The import functionality enables data transfer from an Excel spreadsheet into your Oracle VBS
application. The process begins by fetching the XLSX file, parsing it using SheetJS, and then
creating corresponding Business Object records.
@ -379,7 +404,8 @@ define([
});
```
## Exporting Data {#exporting-data-snippet}
### Exporting Data {#exporting-data-snippet}
The export functionality allows you to convert Business Object data into Excel spreadsheets.
This process involves retrieving data from the Business Object using REST API calls, transforming
it into a format suitable for SheetJS, and generating an XLSX file.
@ -452,7 +478,7 @@ Visual Builder Studio access.
![Oracle Cloud search for "Visual Builder Studio"](pathname:///oraclecloud/search_box_visual_builder.png)
3. Before creating Visual Builder Studio Instances we need to create an instance. Click `Visual Builder` from the left sidebar and click Create an instance.
3. Before creating Visual Builder Studio Instances we need to create an instance. Click `Visual Builder` in the left sidebar, ensure a Compartment is selected in the dropdown, and click "Create Instance".
![Create Visual Builder Instance](pathname:///oraclecloud/create_vb_instance.png)
@ -514,11 +540,11 @@ Visual Builder Studio access.
12. [Adding SheetJS Module](#installation) to the App Click 📄 `Source` from the left sidebar and paste the following on `webApps/sheetjs_demo_app/app-flow.json`
<CodeBlock language="json" value="json" title="copy paste after line 5">{`\
"requirejs": {
"paths": {
"xlsx": "https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js"
}
}
"requirejs": {
"paths": {
"xlsx": "https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min"
}
},
`}
</CodeBlock>
@ -533,7 +559,7 @@ Visual Builder Studio access.
![Darg and drop ui components to canvas](pathname:///oraclecloud/drag_drop_components_to_canvas.png)
14. Creating our button event handler
- Now select the left button in the canvas and on the right side on `General` tab set ID to `import-xslx` and label to `Import XLSX`.
- Now select the left button in the canvas and on the right side on `General` tab set ID to `import-xlsx` and label to `Import XLSX`.
- Now select the `Events` tab and click `+ Event Listener` drop down button and select `On 'ojAction'`
- Now it should auto-select `Action Chains` if not click from top tab option.
- Switch from `Design` to `Code` from top right

@ -129,11 +129,11 @@ This demo was tested in the following deployments:
| Architecture | Version | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `2.7.0` | 2024-12-31 |
| `darwin-arm` | `2.7.0` | 2024-05-23 |
| `darwin-arm` | `2.7.0` | 2025-02-13 |
| `win11-x64` | `2.7.0` | 2024-12-20 |
| `win11-arm` | `2.7.0` | 2024-05-25 |
| `linux-x64` | `2.7.0` | 2024-12-31 |
| `linux-arm` | `2.7.0` | 2024-05-23 |
| `linux-arm` | `2.7.0` | 2025-02-15 |
:::
@ -407,7 +407,7 @@ This demo was tested in the following deployments:
| `darwin-x64` | `2.7.0` | `8.4.2` | 2024-12-31 |
| `darwin-arm` | `2.7.0` | `8.3.8` | 2024-06-30 |
| `linux-x64` | `2.7.0` | `8.3.3` | 2024-12-31 |
| `linux-arm` | `2.7.0` | `8.2.18` | 2024-05-25 |
| `linux-arm` | `2.7.0` | `8.2.26` | 2025-02-15 |
:::
@ -549,7 +549,7 @@ This demo was tested in the following deployments:
| `darwin-x64` | `2.7.0` | `3.13.1` | 2024-12-31 |
| `darwin-arm` | `2.7.0` | `3.12.3` | 2024-06-30 |
| `linux-x64` | `2.7.0` | `3.11.7` | 2024-12-31 |
| `linux-arm` | `2.7.0` | `3.11.2` | 2024-05-25 |
| `linux-arm` | `2.7.0` | `3.11.2` | 2025-02-15 |
:::
@ -643,7 +643,11 @@ file `sheetjsw.xlsb` will be created. That file can be opened with Excel.
:::caution pass
In some tests, the command failed with an `OSError` message.
In some tests, the command failed with an `OSError` message:
```
OSError: libduktape.so.207.20700: cannot open shared object file: No such file or directory
```
The fix is to explicitly add `./` to the `lib` variable in `SheetJSDuk.py`:
@ -740,7 +744,7 @@ It is strongly recommended to colocate allocations and cleanup methods using
`defer`. For example, a Duktape context is created with `duk_create_heap` and
destroyed with `duk_destroy_heap`. The latter call can be deferred:
```zig
```zig title="Colocating cleanup methods with defer"
const ctx = duktape.duk_create_heap(null, null, null, null, null);
defer _ = duktape.duk_destroy_heap(ctx);
```
@ -767,7 +771,7 @@ spiritual equivalent in Zig is to assign to `_`.
The `duk_eval_raw` method and each compile-time constant are available in the
`duktape` scope. A manual translation is shown below:
```zig
```zig title="duk_eval_string_noresult blingo in Zig"
_ = duktape.duk_eval_raw(ctx, src, 0, 0 | duktape.DUK_COMPILE_EVAL | duktape.DUK_COMPILE_NOSOURCE | duktape.DUK_COMPILE_STRLEN | duktape.DUK_COMPILE_NORESULT | duktape.DUK_COMPILE_NOFILENAME);
```
@ -780,11 +784,11 @@ This demo was tested in the following deployments:
| Architecture | Version | Zig | Date |
|:-------------|:--------|:---------|:-----------|
| `darwin-x64` | `2.7.0` | `0.13.0` | 2024-12-31 |
| `darwin-arm` | `2.7.0` | `0.12.0` | 2024-05-23 |
| `darwin-arm` | `2.7.0` | `0.13.0` | 2025-02-13 |
| `win11-x64` | `2.7.0` | `0.13.0` | 2024-12-20 |
| `win11-arm` | `2.7.0` | `0.12.0` | 2024-05-25 |
| `linux-x64` | `2.7.0` | `0.13.0` | 2024-12-31 |
| `linux-arm` | `2.7.0` | `0.12.0` | 2024-05-25 |
| `linux-arm` | `2.7.0` | `0.13.0` | 2025-02-15 |
On Windows, due to incompatibilities between WSL and PowerShell, some commands
must be run in WSL Bash.
@ -1017,7 +1021,7 @@ This demo was tested in the following deployments:
| `darwin-x64` | `2.2.0` | 2024-12-31 |
| `darwin-arm` | `2.2.0` | 2024-06-30 |
| `linux-x64` | `2.2.0` | 2024-12-31 |
| `linux-arm` | `2.2.0` | 2024-05-25 |
| `linux-arm` | `2.2.0` | 2025-02-15 |
:::

@ -147,10 +147,10 @@ This demo was tested in the following deployments:
| V8 Version | Platform | OS Version | Compiler | Date |
|:--------------|:-------------|:--------------|:-----------------|:-----------|
| `13.3.228` | `darwin-x64` | macOS 15.1.1 | `clang 16.0.0` | 2024-12-03 |
| `12.7.130` | `darwin-arm` | macOS 14.5 | `clang 15.0.0` | 2024-05-25 |
| `13.5.92` | `darwin-arm` | macOS 14.5 | `clang 16.0.0` | 2025-02-15 |
| `12.7.130` | `win11-x64` | Windows 11 | `CL 19.42.34435` | 2024-12-20 |
| `12.7.130` | `linux-x64` | HoloOS 3.6.20 | `gcc 13.2.1` | 2025-01-02 |
| `12.7.130` | `linux-arm` | Debian 12 | `gcc 12.2.0` | 2024-05-25 |
| `13.5.92` | `linux-arm` | Debian 12 | `gcc 12.2.0` | 2025-02-15 |
:::
@ -435,11 +435,11 @@ The recommended fix is to delete the referenced folder and re-run `gclient sync`
</Tabs>
5) Checkout the desired version. The following command pulls `13.3.228`:
5) Checkout the desired version. The following command pulls `13.5.92`:
```bash
git checkout tags/13.3.228 -b sample
git checkout tags/13.5.92 -b sample
```
:::caution pass
@ -447,14 +447,14 @@ git checkout tags/13.3.228 -b sample
The official documentation recommends:
```bash
git checkout refs/tags/13.3.228 -b sample -t
git checkout refs/tags/13.5.92 -b sample -t
```
This command failed in local testing:
```
E:\v8\v8>git checkout refs/tags/13.3.228 -b sample -t
fatal: cannot set up tracking information; starting point 'refs/tags/13.3.228' is not a branch
E:\v8\v8>git checkout refs/tags/13.5.92 -b sample -t
fatal: cannot set up tracking information; starting point 'refs/tags/13.5.92' is not a branch
```
:::
@ -558,9 +558,55 @@ Run the build:
ninja -C out.gn/arm64.release.sample v8_monolith
```
:::caution pass
:::danger pass
When this demo was last tested, an assertion failed:
In the most recent test, the build failed with ARM NEON reinterpretation errors:
```
../../src/strings/string-hasher.cc: In static member function static uint64_t v8::internal::ConvertTo8BitHashReader::Read64(const uint8_t*):
../../src/strings/string-hasher.cc:32:55: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
32 | return vget_lane_u64(vreinterpret_u64_u8(vmovn_u16(x)), 0);
| ~~~~~~~~~^~~
../../src/strings/string-hasher.cc:32:56: error: cannot convert int16x8_t to uint16x8_t
32 | return vget_lane_u64(vreinterpret_u64_u8(vmovn_u16(x)), 0);
| ^
| |
| int16x8_t
In file included from ../../src/utils/utils.h:50,
from ../../src/strings/string-hasher-inl.h:10,
from ../../src/strings/string-hasher.cc:8:
/usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:7482:23: note: initializing argument 1 of uint8x8_t vmovn_u16(uint16x8_t)
7482 | vmovn_u16 (uint16x8_t __a)
| ~~~~~~~~~~~^~~
```
Codepaths that use ARM NEON intrinsics should be manually suppressed. There are
two relevant blocks in `src/strings/string-hasher.cc`. Blocks can be disabled by
adding `false &&` to the `elif` preprocessor directives:
```cpp title="src/strings/string-hasher.cc (edit highlighted lines)"
#ifdef __SSE2__
__m128i x = _mm_loadu_si128(reinterpret_cast<const __m128i*>(p));
return _mm_cvtsi128_si64(_mm_packus_epi16(x, x));
// highlight-next-line
#elif false && defined(__ARM_NEON__)
int16x8_t x;
// ...
#ifdef __SSE2__
__m128i x = _mm_loadu_si64(reinterpret_cast<const __m128i*>(p));
return _mm_cvtsi128_si64(_mm_packus_epi16(x, x));
// highlight-next-line
#elif false && defined(__ARM_NEON__)
int8x8_t x;
```
:::
:::note pass
In previous test runs, an assertion failed:
```
../../src/base/small-vector.h: In instantiation of class v8::base::SmallVector<std::pair<const v8::internal::compiler::turboshaft::PhiOp*, const v8::internal::compiler::turboshaft::OpIndex>, 16>:
@ -675,7 +721,7 @@ ld: multiple errors: unknown file type in '/Users/sheetjs/dev/v8/v8/out.gn/x64.r
```bash
g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
-ldl -Lout.gn/arm64.release.sample/obj/ -pthread \
-std=c++17 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
-std=c++20 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX -framework Foundation
./hello_world
```
@ -708,7 +754,7 @@ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith
```bash
g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
-lv8_libbase -lv8_libplatform -ldl -Lout.gn/arm64.release.sample/obj/ -pthread \
-std=c++17 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
-std=c++20 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
./hello_world
```
@ -836,6 +882,19 @@ g++ -I. -Iinclude hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
./hello_world
```
:::
:::caution pass
On macOS, in some V8 versions, the `Foundation` framework is required:
```bash
g++ -I. -Iinclude hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
-ldl -Lobj/ -pthread -std=c++20 \
-DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX -framework Foundation
./hello_world
```
:::
</TabItem>
@ -897,6 +956,18 @@ g++ -I. -Iinclude sheetjs.v8.cc -o sheetjs.v8 -fno-rtti -lv8_monolith \
-DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
```
:::
:::caution pass
On macOS, in some V8 versions, the `Foundation` framework is required:
```bash
g++ -I. -Iinclude sheetjs.v8.cc -o sheetjs.v8 -fno-rtti -lv8_monolith \
-ldl -Lobj/ -pthread -std=c++20 \
-DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX -framework Foundation
```
:::
</TabItem>
@ -964,10 +1035,10 @@ This demo was last tested in the following deployments:
| Architecture | V8 Crate | Date |
|:-------------|:----------|:-----------|
| `darwin-x64` | `130.0.7` | 2025-01-19 |
| `darwin-arm` | `0.92.0` | 2024-05-25 |
| `darwin-arm` | `134.3.0` | 2025-02-13 |
| `win11-x64` | `130.0.2` | 2024-12-20 |
| `linux-x64` | `130.0.7` | 2025-01-09 |
| `linux-arm` | `0.92.0` | 2024-05-25 |
| `linux-arm` | `134.4.0` | 2025-02-15 |
:::
@ -1050,7 +1121,7 @@ This demo was last tested in the following deployments:
| `darwin-arm` | `12.6.228.13` | `3.1.3` | `11.0.23` | 2024-06-19 |
| `win11-x64` | `12.6.228.13` | `3.1.3` | `21.0.5` | 2024-12-20 |
| `linux-x64` | `12.6.228.13` | `3.1.3` | `17.0.7` | 2024-06-20 |
| `linux-arm` | `12.6.228.13` | `3.1.3` | `17.0.11` | 2024-06-20 |
| `linux-arm` | `13.2.152.16` | `4.1.1` | `17.0.14` | 2025-02-16 |
:::
@ -1092,7 +1163,8 @@ curl -LO https://repo1.maven.org/maven2/com/caoccao/javet/javet/3.1.3/javet-3.1.
<TabItem value="linux-arm" label="Linux ARM">
```bash
curl -LO https://repo1.maven.org/maven2/com/caoccao/javet/javet-linux-arm64/3.1.3/javet-linux-arm64-3.1.3.jar
curl -LO https://repo1.maven.org/maven2/com/caoccao/javet/javet/4.1.1/javet-4.1.1.jar
curl -LO https://repo1.maven.org/maven2/com/caoccao/javet/javet-v8-linux-arm64/4.1.1/javet-v8-linux-arm64-4.1.1.jar
```
</TabItem>
@ -1160,8 +1232,8 @@ java -cp ".:javet-3.1.3.jar" SheetJSJavet pres.xlsx
<TabItem value="linux-arm" label="Linux ARM">
```bash
javac -cp ".:javet-linux-arm64-3.1.3.jar" SheetJSJavet.java
java -cp ".:javet-linux-arm64-3.1.3.jar" SheetJSJavet pres.xlsx
javac -cp ".:javet-4.1.1.jar:javet-v8-linux-arm64-4.1.1.jar" SheetJSJavet.java
java -cp ".:javet-4.1.1.jar:javet-v8-linux-arm64-4.1.1.jar" SheetJSJavet pres.xlsx
```
</TabItem>
@ -1211,7 +1283,7 @@ This demo was last tested in the following deployments:
| `win11-x64` | `12.3.219.12` | 2024-12-20 |
| `win11-arm` | `12.3.219.12` | 2024-07-16 |
| `linux-x64` | `12.3.219.12` | 2025-01-10 |
| `linux-arm` | `12.3.219.12` | 2024-07-16 |
| `linux-arm` | `12.3.219.12` | 2025-02-16 |
:::
@ -1501,7 +1573,7 @@ This demo was last tested in the following deployments:
| `darwin-arm` | `12.6.228.3` | `0.92.0` | 2024-12-20 |
| `win11-x64` | `12.6.228.3` | `0.92.0` | 2024-12-20 |
| `linux-x64` | `12.6.228.3` | `0.92.0` | 2025-01-02 |
| `linux-arm` | `12.6.228.3` | `0.92.0` | 2024-05-26 |
| `linux-arm` | `13.4.114.9` | `134.4.0` | 2025-02-15 |
:::

@ -42,7 +42,7 @@ JavaScriptCore can be built from source and linked in C / C++ programs.
| Architecture | Version | Date |
|:-------------|:-----------------|:-----------|
| `darwin-x64` | `7618.2.12.11.7` | 2025-01-10 |
| `darwin-arm` | `7618.2.12.11.7` | 2024-05-24 |
| `darwin-arm` | `7620.2.4.111.7` | 2025-02-13 |
| `linux-x64` | `7618.2.12.11.7` | 2024-06-22 |
| `linux-arm` | `7618.2.12.11.7` | 2024-06-22 |
@ -446,8 +446,8 @@ cd sheetjs-jsc
2) Download and extract the WebKit snapshot:
```bash
curl -LO https://codeload.github.com/WebKit/WebKit/zip/refs/tags/WebKit-7618.2.12.11.7
mv WebKit-7618.2.12.11.7 WebKit.zip
curl -LO https://codeload.github.com/WebKit/WebKit/zip/refs/tags/WebKit-7620.2.4.111.7
mv WebKit-7620.2.4.111.7 WebKit.zip
unzip WebKit.zip
```
@ -457,7 +457,7 @@ unzip WebKit.zip
<TabItem value="darwin-x64" label="MacOS">
```bash
cd WebKit-WebKit-7618.2.12.11.7
cd WebKit-WebKit-7620.2.4.111.7
Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON"
cd ..
```
@ -468,8 +468,8 @@ When this demo was last tested on ARM64 macOS, JIT elicited runtime errors and
WebAssembly elicited compile-time errors. WebAssembly and JIT must be disabled:
```bash
cd WebKit-WebKit-7618.2.12.11.7
Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON" --no-jit --no-webassembly
cd WebKit-WebKit-7620.2.4.111.7
env CFLAGS="-Wno-error -Wno-deprecated-declarations" CXXFLAGS="-Wno-error -Wno-deprecated-declarations" LDFLAGS="-framework Foundation" Tools/Scripts/build-webkit --jsc-only --cmakeargs="-Wno-error -DENABLE_STATIC_JSC=ON -DCMAKE_C_FLAGS=\"-Wno-error -Wno-deprecated-declarations\" -DCMAKE_CXX_FLAGS=\"-Wno-error -Wno-deprecated-declarations\"" --no-jit --no-webassembly --make-args="-Wno-error -Wno-deprecated-declarations"
cd ..
```
@ -529,8 +529,8 @@ The `#include` should be changed to a relative directive:
<TabItem value="linux-x64" label="Linux">
```bash
cd WebKit-WebKit-7618.2.12.11.7
env CFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" CXXFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" Tools/Scripts/build-webkit --jsc-only --cmakeargs="-Wno-error -DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF -DCMAKE_C_FLAGS=\"-Wno-error -Wno-dangling-reference\" -DCMAKE_CXX_FLAGS=-Wno-error -Wno-dangling-reference" --make-args="-j1 -Wno-error -Wno-error=dangling-reference" -j1
cd WebKit-WebKit-7620.2.4.111.7
env CFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" CXXFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" Tools/Scripts/build-webkit --jsc-only --cmakeargs="-Wno-error -DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF -DCMAKE_C_FLAGS=\"-Wno-error -Wno-dangling-reference\" -DCMAKE_CXX_FLAGS=\"-Wno-error -Wno-dangling-reference\"" --make-args="-j1 -Wno-error -Wno-error=dangling-reference" -j1
cd ..
```
@ -573,7 +573,7 @@ The error can be suppressed with preprocessor directives around the definition:
After patching the header, JSC must be built without WebAssembly or JIT support:
```bash
cd WebKit-WebKit-7618.2.12.11.7
cd WebKit-WebKit-7620.2.4.111.7
env CFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" CXXFLAGS="-Wno-error=dangling-reference -Wno-dangling-reference" Tools/Scripts/build-webkit --jsc-only --cmakeargs="-Wno-error -DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF -DCMAKE_C_FLAGS=\"-Wno-error -Wno-dangling-reference\" -DCMAKE_CXX_FLAGS=-Wno-error -Wno-dangling-reference" --make-args="-j1 -Wno-error -Wno-error=dangling-reference" -j1 --no-jit --no-webassembly
cd ..
```
@ -586,7 +586,7 @@ cd ..
4) Create a symbolic link to the `Release` folder in the source tree:
```bash
ln -s WebKit-WebKit-7618.2.12.11.7/WebKitBuild/JSCOnly/Release/ .
ln -s WebKit-WebKit-7620.2.4.111.7/WebKitBuild/JSCOnly/Release/ .
```
5) Download [`sheetjs-jsc.c`](pathname:///jsc/sheetjs-jsc.c):
@ -601,7 +601,7 @@ curl -LO https://docs.sheetjs.com/jsc/sheetjs-jsc.c
<TabItem value="darwin-x64" label="MacOS">
```bash
g++ -o sheetjs-jsc sheetjs-jsc.c -IRelease/JavaScriptCore/Headers -LRelease/lib -lbmalloc -licucore -lWTF -lJavaScriptCore -IRelease/JavaScriptCore/Headers
g++ -o sheetjs-jsc sheetjs-jsc.c -IRelease/JavaScriptCore/Headers -LRelease/lib -lbmalloc -licucore -lWTF -lJavaScriptCore -IRelease/JavaScriptCore/Headers -framework Foundation
```
</TabItem>
@ -736,7 +736,7 @@ curl -LO https://docs.sheetjs.com/swift/SheetJSCRaw.swift
11) Build `SheetJSwift`:
```bash
swiftc -Xcc -I$(pwd) -Xlinker -L../WebKit-WebKit-7618.2.12.11.7/WebKitBuild/JSCOnly/Release/lib/ -Xlinker -lJavaScriptCore -Xlinker -lWTF -Xlinker -lbmalloc -Xlinker -lstdc++ -Xlinker -latomic -Xlinker -licuuc -Xlinker -licui18n -import-objc-header JavaScriptCore-Bridging-Header.h SheetJSCRaw.swift -o SheetJSwift
swiftc -Xcc -I$(pwd) -Xlinker -L../WebKit-WebKit-7620.2.4.111.7/WebKitBuild/JSCOnly/Release/lib/ -Xlinker -lJavaScriptCore -Xlinker -lWTF -Xlinker -lbmalloc -Xlinker -lstdc++ -Xlinker -latomic -Xlinker -licuuc -Xlinker -licui18n -import-objc-header JavaScriptCore-Bridging-Header.h SheetJSCRaw.swift -o SheetJSwift
```
12) Run the command:

@ -164,11 +164,11 @@ This demo was tested in the following deployments:
| Architecture | Jint | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `4.1.0` | 2024-12-17 |
| `darwin-arm` | `3.1.2` | 2024-05-25 |
| `darwin-arm` | `4.2.0` | 2025-02-13 |
| `win11-x64` | `4.1.0` | 2024-12-20 |
| `win11-arm` | `3.1.2` | 2024-05-25 |
| `linux-x64` | `4.1.0` | 2025-01-09 |
| `linux-arm` | `3.1.2` | 2024-05-25 |
| `linux-arm` | `4.2.0` | 2025-02-15 |
:::
@ -248,7 +248,7 @@ dotnet run
```bash
dotnet nuget add source https://www.myget.org/F/jint/api/v3/index.json
dotnet add package Jint --version 4.1.0
dotnet add package Jint --version 4.2.0
```
To verify Jint is installed, replace `Program.cs` with the following:
@ -472,7 +472,7 @@ cp bin/Release/net*/osx-x64/publish/SheetJSJint .
For Apple Silicon, the RID is `osx-arm64` and the command is:
```bash
cp bin/Release/net6.0/osx-arm64/publish/SheetJSJint .
cp bin/Release/net*/osx-arm64/publish/SheetJSJint .
```
</TabItem>
@ -490,7 +490,7 @@ cp bin/Release/net*/linux-x64/publish/SheetJSJint .
For x64 Linux, the RID is `linux-arm64` and the command is
```bash
cp bin/Release/net6.0/linux-arm64/publish/SheetJSJint .
cp bin/Release/net*/linux-arm64/publish/SheetJSJint .
```
</TabItem>

@ -106,11 +106,11 @@ This demo was tested in the following deployments:
| Architecture | Git Commit | Go version | Date |
|:-------------|:-----------|:-----------|:-----------|
| `darwin-x64` | `79f3a7e` | `1.23.3` | 2024-12-17 |
| `darwin-arm` | `ccbae20` | `1.22.3` | 2024-05-23 |
| `darwin-arm` | `5ef83b8` | `1.24.0` | 2025-02-13 |
| `win11-x64` | `79f3a7e` | `1.23.4` | 2024-12-20 |
| `win11-arm` | `ccbae20` | `1.22.3` | 2024-05-25 |
| `linux-x64` | `79f3a7e` | `1.22.0` | 2025-01-02 |
| `linux-arm` | `ccbae20` | `1.19.8` | 2024-05-25 |
| `linux-arm` | `5ef83b8` | `1.19.8` | 2025-02-15 |
At the time of writing, Goja did not have proper version numbers. Versions are
identified by Git commit hashes.

@ -268,7 +268,7 @@ This demo was tested in the following deployments:
| `win11-x64` | `6e2e68f` | 2024-12-19 |
| `win11-arm` | `d378a9f` | 2024-05-25 |
| `linux-x64` | `6e2e68f` | 2025-01-09 |
| `linux-arm` | `d378a9f` | 2024-05-25 |
| `linux-arm` | `6e2e68f` | 2025-02-15 |
When the demo was tested, `6e2e68f` was the HEAD commit on the `master` branch.

@ -365,9 +365,9 @@ This demo was tested in the following deployments:
| Architecture | Git Commit | Date |
|:-------------|:-----------|:-----------|
| `darwin-x64` | `d070c74` | 2024-12-17 |
| `darwin-arm` | `d070c74` | 2024-05-23 |
| `darwin-arm` | `388376f` | 2025-01-13 |
| `linux-x64` | `388376f` | 2024-12-17 |
| `linux-arm` | `d070c74` | 2024-05-25 |
| `linux-arm` | `388376f` | 2025-02-15 |
The main Hermes source tree does not have Windows support. The `hermes-windows`
fork, which powers React Native for Windows, does have built-in support[^5]
@ -403,7 +403,7 @@ sudo pacman -Syu cmake git ninja icu python zip readline
On Debian and Ubuntu:
```bash
sudo apt install cmake git ninja-build libicu-dev python zip libreadline-dev
sudo apt install cmake git ninja-build libicu-dev python3 python-is-python3 zip libreadline-dev
```
:::note pass

@ -88,11 +88,11 @@ This demo was tested in the following deployments:
| Platform | Ruby | ExecJS | Date |
|:-------------|:---------|:---------|:-----------|
| `darwin-x64` | `2.6.10` | `2.10.0` | 2024-12-17 |
| `darwin-arm` | `2.6.10` | `2.9.1` | 2024-05-25 |
| `darwin-arm` | `2.6.10` | `2.10.0` | 2025-02-13 |
| `win11-x64` | `3.3.6` | `2.10.0` | 2024-12-20 |
| `win11-arm` | `3.0.2` | `2.9.1` | 2024-05-25 |
| `linux-x64` | `3.0.6` | `2.10.0` | 2024-12-31 |
| `linux-arm` | `3.1.2` | `2.9.1` | 2024-05-25 |
| `linux-arm` | `3.1.2` | `2.10.0` | 2025-02-15 |
When the demo was last tested, there was no official Ruby release for Windows
on ARM. The `win11-arm` test was run in WSL.
@ -123,6 +123,12 @@ installed through the package manager:
sudo pacman -Syu rubygems
```
In Debian, the `rubygems-integration` package should be installed:
```bash
sudo apt-get install ruby rubygems-integration
```
:::
</details>

@ -133,7 +133,7 @@ This demo was tested in the following deployments:
| Architecture | Git Commit | Date |
|:-------------|:-----------|:-----------|
| `darwin-x64` | `e26c81f` | 2024-12-17 |
| `darwin-arm` | `3a7b120` | 2024-05-23 |
| `darwin-arm` | `e26c81f` | 2025-01-13 |
| `win11-x64` | `e26c81f` | 2024-12-19 |
| `win11-arm` | `13358c6` | 2024-07-14 |
| `linux-x64` | `e26c81f` | 2025-01-09 |
@ -264,6 +264,55 @@ ln -s /opt/homebrew/opt/icu4c usr/local/opt/icu4c
cd ..
```
:::
:::caution pass
In some test runs, compilation failed with `operator` errors:
```
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include/c++/v1/new:279:66: error: redefinition of 'operator new'
279 | _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT {
| ^
/tmp/sheetjs-chakra/ChakraCore/lib/Common/Memory/Allocator.h:457:1: note: previous definition is here
457 | operator new(
| ^
```
The `ChakraCore/lib/Common/Memory/Allocator.h` header file must be fixed:
```diff title="ChakraCore/lib/Common/Memory/Allocator.h (apply the following patch)"
diff --git a/lib/Common/Memory/Allocator.h b/lib/Common/Memory/Allocator.h
index 5a3a099bc..e05a7390f 100644
--- a/lib/Common/Memory/Allocator.h
+++ b/lib/Common/Memory/Allocator.h
@@ -452,24 +452,7 @@ void AssertValue(void * mem, T value, uint byteCount)
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
-_Ret_notnull_
-NO_EXPORT(inline void *) __cdecl
-operator new(
-DECLSPEC_GUARD_OVERFLOW size_t byteSize,
-_In_ void * previousAllocation) throw()
-{
- return previousAllocation;
-}
-
-
-NO_EXPORT(inline void) __cdecl
-operator delete(
-void * allocationToFree, // Allocation to free
-void * previousAllocation // Previously allocated memory
-) throw()
-{
-
-}
+#include <new>
#endif
```
:::
</TabItem>

@ -121,11 +121,11 @@ This demo was tested in the following deployments:
| Architecture | Boa | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `0.20.0` | 2024-12-17 |
| `darwin-arm` | `0.18.0` | 2024-05-23 |
| `darwin-arm` | `0.20.0` | 2025-02-13 |
| `win11-x64` | `0.20.0` | 2024-12-19 |
| `win11-arm` | `0.18.0` | 2024-05-25 |
| `linux-x64` | `0.20.0` | 2024-12-31 |
| `linux-arm` | `0.18.0` | 2024-05-25 |
| `linux-arm` | `0.20.0` | 2025-02-15 |
:::

@ -128,9 +128,9 @@ This demo was tested in the following deployments:
| Architecture | Version | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `0.066` | 2024-12-17 |
| `darwin-arm` | `0.066` | 2024-05-25 |
| `darwin-arm` | `0.066` | 2025-02-13 |
| `linux-x64` | `0.066` | 2025-01-10 |
| `linux-arm` | `0.066` | 2024-05-25 |
| `linux-arm` | `0.066` | 2025-02-15 |
:::

@ -37,11 +37,11 @@ This demo was tested in the following environments:
| Architecture | Commit | Date |
|:-------------|:----------|:-----------|
| `darwin-x64` | `d2d30df` | 2024-12-17 |
| `darwin-arm` | `35465ed` | 2024-05-25 |
| `darwin-arm` | `d2d30df` | 2025-02-13 |
| `win11-x64` | `d2d30df` | 2024-12-19 |
| `win11-arm` | `35465ed` | 2024-05-25 |
| `linux-x64` | `d2d30df` | 2024-12-31 |
| `linux-arm` | `35465ed` | 2024-05-25 |
| `linux-arm` | `5020015` | 2025-02-15 |
The Windows tests were run in WSL.

@ -323,11 +323,11 @@ This demo was tested in the following deployments:
| Architecture | Version | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `1.3.5` | 2024-12-17 |
| `darwin-arm` | `1.3.4` | 2024-05-23 |
| `darwin-arm` | `1.3.5` | 2025-02-13 |
| `win11-x64` | `1.3.5` | 2024-12-19 |
| `win11-arm` | `1.3.4` | 2024-06-20 |
| `linux-x64` | `1.3.5` | 2025-01-09 |
| `linux-arm` | `1.3.4` | 2024-05-25 |
| `linux-arm` | `1.3.5` | 2025-02-15 |
:::
@ -336,7 +336,8 @@ This demo was tested in the following deployments:
MuJS distributions do not include native Windows projects. The `win11-x64` and
`win11-arm` tests were run entirely within Windows Subsystem for Linux.
When building in WSL, `libreadline-dev` and `build-essential` must be installed:
When building in Debian Linux or WSL, `libreadline-dev` and `build-essential`
must be installed:
```bash
sudo apt-get install libreadline-dev build-essential

@ -181,7 +181,7 @@ This demo was tested in the following deployments:
| `win11-x64` | `3.2.8` | 2024-12-19 |
| `win11-arm` | `3.2.7` | 2024-07-14 |
| `linux-x64` | `3.2.8` | 2025-01-10 |
| `linux-arm` | `3.2.7` | 2024-06-20 |
| `linux-arm` | `3.2.9` | 2025-02-15 |
:::
@ -260,7 +260,7 @@ dotnet run
4) Add Jurassic using the NuGet tool:
```bash
dotnet add package Jurassic --version 3.2.8
dotnet add package Jurassic --version 3.2.9
```
To verify Jurassic is installed, replace `Program.cs` with the following:

@ -1,6 +1,7 @@
---
sidebar_position: 3
title: HTML
title: HTML Tables
sidebar_label: HTML
---
HTML is a common format for presenting data in the web. While the general read
@ -8,7 +9,7 @@ functions (`XLSX.read` and `XLSX.readFile`) can parse HTML strings and the write
functions (`XLSX.write` and `XLSX.writeFile`) can generate HTML strings, the
utility functions in this section can use DOM features.
:::note pass
:::tip pass
SheetJS CE primarily focuses on data and number formatting.
@ -29,12 +30,12 @@ The `sheet_to_html` method generates HTML strings from SheetJS worksheets[^1].
The following options are supported:
| Option Name | Default | Description |
|:------------|:--------:|:----------------------------------------------------|
| `id` | | Specify the `id` attribute for the `TABLE` element |
| `editable` | false | If true, set `contenteditable="true"` for every TD |
| `header` | | Override header |
| `footer` | | Override footer |
| Option | Default | Description |
|:-----------|:-------:|:----------------------------------------------------|
| `id` | (no ID) | Set the `id` attribute for the `TABLE` element |
| `editable` | `false` | If true, set `contenteditable="true"` for every TD |
| `header` | | Override header |
| `footer` | | Override footer |
This example fetches [`pres.numbers`](https://docs.sheetjs.com/pres.numbers) and
generates an HTML TABLE from the contents of the first worksheet:
@ -69,20 +70,56 @@ under the hood.
:::
### Implementation Details
### Value Attributes
The generated table will include special data attributes on each `TD` element:
| Attribute | Description |
|:----------|:-------------------------------------------------------------|
| `data-t` | Override [Cell Type](/docs/csf/cell#cell-types) |
| `data-v` | Override Cell Value |
| `data-v` | Override [Cell Value](/docs/csf/cell#underlying-values) |
| `data-z` | Override [Number Format](/docs/csf/features/nf) |
External cell links will be written as `A` tags wrapping the cell contents.
### Hyperlinks
[External cell links](/docs/csf/features/hyperlinks#external-hyperlinks) will be
written with HTML `A` tags wrapping the cell contents.
<details open>
<summary><b>Live Example</b> (click to hide)</summary>
This demo creates a worksheet where cell A1 links to https://sheetjs.com . After
creating the worksheet, the script generates a HTML TABLE with a hyperlink.
```jsx live
function SimpleLink2HTML() {
const [ __html, setHTML ] = React.useState("");
React.useEffect(() => {
/* Create worksheet */
var ws = XLSX.utils.aoa_to_sheet([ [ "Link", "No Link" ] ]);
/* Add link */
ws["A1"].l = { Target: "https://sheetjs.com" };
setHTML(XLSX.utils.sheet_to_html(ws));
}, []);
return ( <div dangerouslySetInnerHTML={{__html}}/> );
}
```
</details>
## HTML Table Input
:::note pass
The SheetJS [`read` and `readFile` methods](/docs/api/parse-options) can parse
HTML strings and extract table data.
The methods in this section support DOM elements obtained using `getElementById`
or `querySelector`.
:::
### Create New Sheet
**Create a worksheet or workbook from a TABLE element**
@ -100,14 +137,14 @@ as strings.
Both functions accept options arguments:
| Option Name | Default | Description |
| :---------- | :------: | :-------------------------------------------------- |
|`raw` | | If true, every cell will hold raw strings |
|`dateNF` | FMT 14 | Use specified date format in string output |
|`cellDates` | false | Store dates as type `d` (default is `n`) |
|`sheetRows` | 0 | If >0, read the first `sheetRows` rows of the table |
|`display` | false | If true, hidden rows and cells will not be parsed |
|`UTC` | false | If true, dates are interpreted as UTC ** |
| Option | Default | Description |
|:------------|:--------:|:----------------------------------------------------|
| `raw` | | If true, every cell will hold raw strings |
| `dateNF` | `m/d/yy` | Use specified date format in string output |
| `cellDates` | `false` | Store dates as type `d` (default is `n`) |
| `sheetRows` | `0` | If >0, read the first `sheetRows` rows of the table |
| `display` | `false` | If true, hidden rows and cells will not be parsed |
| `UTC` | `false` | If true, dates are interpreted as UTC ** |
[UTC option is explained in "Dates"](/docs/csf/features/dates#utc-option)

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
v8 = "0.92.0"
v8 = "134.4.0"
[[bin]]
name = "sheet2csv"

@ -33,7 +33,7 @@ fn main() {
let params = v8::Isolate::create_params().snapshot_blob(startup_data);
let isolate = &mut v8::Isolate::new(params);
let handle_scope = &mut v8::HandleScope::new(isolate);
let context = v8::Context::new(handle_scope);
let context = v8::Context::new(handle_scope, Default::default());
let context_scope = &mut v8::ContextScope::new(handle_scope, context);
/* read file */

@ -13,13 +13,13 @@ fn main() {
v8::V8::initialize();
/* use SnapshotCreator */
let mut isolate = v8::Isolate::snapshot_creator(None);
let mut isolate = v8::Isolate::snapshot_creator(None, Default::default());
/* scope enforces the lifetime of the `&mut isolate` in `handle_scope` */
{
/* same steps as normal flow */
let handle_scope = &mut v8::HandleScope::new(&mut isolate);
let context = v8::Context::new(handle_scope);
let context = v8::Context::new(handle_scope, Default::default());
let context_scope = &mut v8::ContextScope::new(handle_scope, context);
/* instructs the snapshot creator to dump the new context */

@ -13,6 +13,6 @@ npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz exit-on-epipe c
## NOTE: these steps are for darwin-x64
npx boxednode@2.4.3 -s xlsx-cli.js -t xlsx-cli
npx -y boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli
./xlsx-cli pres.numbers

@ -9,7 +9,10 @@ deno --version
curl -o pres.numbers https://docs.sheetjs.com/pres.numbers
deno run -r --allow-read https://docs.sheetjs.com/cli/sheet2csv.ts pres.numbers
## deno run -r --allow-read https://docs.sheetjs.com/cli/sheet2csv.ts pres.numbers
deno run -r --allow-read --allow-import https://docs.sheetjs.com/cli/sheet2csv.ts pres.numbers
## deno compile -r --allow-read https://docs.sheetjs.com/cli/sheet2csv.ts
deno compile -r --allow-read --allow-import https://docs.sheetjs.com/cli/sheet2csv.ts
deno compile -r --allow-read https://docs.sheetjs.com/cli/sheet2csv.ts
./sheet2csv pres.numbers

@ -11,8 +11,7 @@ curl -o xlsx-cli.js https://docs.sheetjs.com/cli/xlsx-cli.js
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz exit-on-epipe commander@2
## NOTE: these steps are for darwin-x64
npx nexe -t 14.15.3 xlsx-cli.js
## npx -y nexe -t 14.15.3 xlsx-cli.js ## does not work on arm64
npx -y nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"
./xlsx-cli pres.numbers

@ -48,16 +48,18 @@ EOF
node --experimental-sea-config sheet2csv.json
## NOTE: these steps are for darwin-x64
cp `which node` sheet2csv
codesign --remove-signature ./sheet2csv
## NOTE: codesign required for macOS
command -v codesign
has_cs=$?
if [[ "$has_cs" == "0" ]]; then codesign --remove-signature ./sheet2csv; fi
npx -y postject --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA sheet2csv NODE_SEA_BLOB sheet2csv.blob
codesign -s - ./sheet2csv
if [[ "$has_cs" == "0" ]]; then codesign -s - ./sheet2csv; fi
./sheet2csv pres.numbers
codesign -dv ./sheet2csv
if [[ "$has_cs" == "0" ]]; then codesign -dv ./sheet2csv; fi

@ -13,8 +13,8 @@ npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz exit-on-epipe c
## NOTE: must downgrade to node 18
npx pkg xlsx-cli.js
npx -y pkg xlsx-cli.js
## NOTE: these steps are for darwin-x64
## NOTE: these steps are for darwin
./xlsx-cli-macos pres.numbers

89
tests/engines-chakracore.sh Executable file

@ -0,0 +1,89 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/chakra
cd /tmp
rm -rf sheetjs-chakra
mkdir sheetjs-chakra
cd sheetjs-chakra
git clone https://github.com/chakra-core/ChakraCore.git
cd ChakraCore
git checkout e26c81f
cd ..
cd ChakraCore
## in commit e26c81f in macOS 15.2, the build fails with the following error:
##
##/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr/include/c++/v1/new:279:66: error: redefinition of 'operator new'
## 279 | _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT {
## | ^
##/tmp/sheetjs-chakra/ChakraCore/lib/Common/Memory/Allocator.h:457:1: note: previous definition is here
## 457 | operator new(
## | ^
##
## This patch avoids the issues
cat <<EOF >sheetjs.patch
diff --git a/lib/Common/Memory/Allocator.h b/lib/Common/Memory/Allocator.h
index 5a3a099bc..e05a7390f 100644
--- a/lib/Common/Memory/Allocator.h
+++ b/lib/Common/Memory/Allocator.h
@@ -452,24 +452,7 @@ void AssertValue(void * mem, T value, uint byteCount)
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
-_Ret_notnull_
-NO_EXPORT(inline void *) __cdecl
-operator new(
-DECLSPEC_GUARD_OVERFLOW size_t byteSize,
-_In_ void * previousAllocation) throw()
-{
- return previousAllocation;
-}
-
-
-NO_EXPORT(inline void) __cdecl
-operator delete(
-void * allocationToFree, // Allocation to free
-void * previousAllocation // Previously allocated memory
-) throw()
-{
-
-}
+#include <new>
#endif
EOF
git apply sheetjs.patch
./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=8 --no-jit
cd ..
curl -L -O https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
curl -L -O https://docs.sheetjs.com/chakra/Makefile
make
curl -L -O https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -L -O https://cdn.sheetjs.com/xlsx-latest/package/dist/shim.min.js
curl -L -O https://docs.sheetjs.com/pres.numbers
./sheetjs.ch pres.numbers
cp ChakraCore/out/Test/ch .
node -e "fs.writeFileSync('payload.js', 'var payload = \"' + fs.readFileSync('pres.numbers').toString('base64') + '\";')"
cat <<EOF >global.js
var global = (function(){ return this; }).call(null);
EOF
cat <<EOF >chakra.js
var wb = XLSX.read(payload, {type:'base64'});
console.log(XLSX.utils.sheet_to_csv(wb.Sheets[wb.SheetNames[0]]));
EOF
cat global.js xlsx.full.min.js payload.js chakra.js > xlsx.chakra.js
./ch xlsx.chakra.js

22
tests/engines-duktape.sh Executable file

@ -0,0 +1,22 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/duktape
cd /tmp
rm -rf sheetjs-duk
mkdir sheetjs-duk
cd sheetjs-duk
curl -LO https://duktape.org/duktape-2.7.0.tar.xz
tar -xJf duktape-2.7.0.tar.xz
mv duktape-2.7.0/src/*.{c,h} .
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/duk/sheetjs.duk.c
gcc -std=c99 -Wall -osheetjs.duk sheetjs.duk.c duktape.c -lm
./sheetjs.duk pres.numbers
npx -y xlsx-cli sheetjsw.xlsb

@ -1,13 +1,17 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/rb
cd /tmp
rm -rf sheetjs-rb
mkdir -p sheetjs-rb
cd sheetjs-rb
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -LO https://sheetjs.com/pres.numbers
curl -LO https://docs.sheetjs.com/pres.numbers
curl -LO https://docs.sheetjs.com/execjs/ExecSheetJS.rb
ruby ExecSheetJS.rb pres.numbers; echo $?
npx -y xlsx-cli sheetjsw.xlsb

@ -8,12 +8,13 @@ mkdir sheetjs-mu
cd sheetjs-mu
curl -LO https://mujs.com/downloads/mujs-1.3.5.zip
unzip mujs-1.3.5.zip
cd mujs-1.3.5
unzip mujs-*.zip
rm mujs-*.zip
cd mujs-*
make release
cd ..
cp mujs-1.3.5/build/release/libmujs.a mujs-1.3.5/mujs.h .
cp mujs-*/build/release/libmujs.a mujs-*/mujs.h .
curl -LO https://docs.sheetjs.com/mujs/SheetJSMu.c

24
tests/engines-perl.sh Executable file

@ -0,0 +1,24 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/perl
cd /tmp
rm -rf sheetjs-perl
mkdir sheetjs-perl
cd sheetjs-perl
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.extendscript.js
curl -LO https://docs.sheetjs.com/perl/SheetJE.pl
curl -LO https://docs.sheetjs.com/cd.xls
perl SheetJE.pl cd.xls ||
cat <<EOF
If the script failed with an error about JE or Slurp, install dependencies:
$ cpan install JE File::Slurp
This command may need to be run as root:
$ sudo cpan install JE File::Slurp
EOF

21
tests/engines-v8-rust.sh Executable file

@ -0,0 +1,21 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/v8
cd /tmp
rm -rf sheetjs-rustyv8
cargo new sheetjs-rustyv8
cd sheetjs-rustyv8
cargo run
cargo add v8
cargo run
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -LO https://docs.sheetjs.com/pres.numbers
curl -L -o src/main.rs https://docs.sheetjs.com/v8/main.rs
cargo run --release pres.numbers; echo $?
npx -y xlsx-cli sheetjsw.xlsb

23
tests/engines-v8-snapshot.sh Executable file

@ -0,0 +1,23 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/v8
cd /tmp
rm -rf sheetjs2csv
mkdir sheetjs2csv
cd sheetjs2csv
curl -o Cargo.toml https://docs.sheetjs.com/cli/Cargo.toml
curl -o snapshot.rs https://docs.sheetjs.com/cli/snapshot.rs
curl -o sheet2csv.rs https://docs.sheetjs.com/cli/sheet2csv.rs
curl -o xlsx.full.min.js https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -o xlsx.zahl.js https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.zahl.js
curl -o pres.numbers https://docs.sheetjs.com/pres.numbers
cargo build --bin snapshot
cargo run --bin snapshot
cargo build --release --bin sheet2csv; echo $?
mv target/release/sheet2csv .
./sheet2csv pres.numbers; echo $?

56
tests/installation/bun.sh Executable file

@ -0,0 +1,56 @@
#!/bin/bash
# https://docs.sheetjs.com/docs/getting-started/installation/bun
cd /tmp
rm -rf sheetjs-bun-dle
mkdir sheetjs-bun-dle
cd sheetjs-bun-dle
echo "{}" > package.json
bun install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz || bun install xlsx@https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
cat <<EOF >SheetJSBun.js
import * as XLSX from 'xlsx';
import * as fs from 'fs';
XLSX.set_fs(fs);
/* fetch JSON data and parse */
const url = "https://docs.sheetjs.com/executive.json";
const raw_data = await (await fetch(url)).json();
/* filter for the Presidents */
const prez = raw_data.filter(row => row.terms.some(term => term.type === "prez"));
/* sort by first presidential term */
prez.forEach(row => row.start = row.terms.find(term => term.type === "prez").start);
prez.sort((l,r) => l.start.localeCompare(r.start));
/* flatten objects */
const rows = prez.map(row => ({
name: row.name.first + " " + row.name.last,
birthday: row.bio.birthday
}));
/* generate worksheet and workbook */
const worksheet = XLSX.utils.json_to_sheet(rows);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, "Dates");
/* fix headers */
XLSX.utils.sheet_add_aoa(worksheet, [["Name", "Birthday"]], { origin: "A1" });
/* calculate column width */
const max_width = rows.reduce((w, r) => Math.max(w, r.name.length), 10);
worksheet["!cols"] = [ { wch: max_width } ];
/* create an XLSX file and try to save to Presidents.xlsx */
XLSX.writeFile(workbook, "Presidents.xlsx");
EOF
bun build --target=bun SheetJSBun.js --outfile=app.js
rm -f package.json bun.lockb bun.lock SheetJSBun.js
rm -rf ./node_modules
bun app.js
bunx xlsx-cli Presidents.xlsx