Windows x86 migration of desktop demos

This commit is contained in:
SheetJS 2024-12-21 23:47:57 -05:00
parent 4c2fe5f75f
commit 93c8689285
54 changed files with 338 additions and 140 deletions

@ -20,7 +20,10 @@ sql
# Excel-related terms
A1
A1-Style
A2
A7
AutoFilter
B7
BIFF12
BIFF2
BIFF3
@ -41,14 +44,17 @@ FM3
FMT
FODS
FoxPro
Gmail
IEEE754
JSON
Macrosheet
Macrosheets
Multiplan
NodeMailer
ODF
ODS
OData
ORM
OpenDocument
OpenFormula
PRN
@ -109,6 +115,7 @@ tooltips
# Other terms
1.x
2.x
2FA
3.x
4.x
5.x
@ -116,21 +123,27 @@ tooltips
7.x
8.x
9.x
AArch64
APIs
APK
ARM64
ActiveX
Airtable
AlaSQL
AngularJS
AppleScript
ArrayBuffer
AstroJS
Auth
BOM
Base64
Base64-encoded
Big5
BitBucket
Blazor
Booleans
Browserify
BunJS
Bundlers
CDN
CEP
@ -138,72 +151,106 @@ CLI
CMS
CORS
CPAN
CRA
CRX
CS6
CTRL
CapacitorJS
Chakra
ChakraCore
CheerioJS
ClearScript
CocoaPods
CommonJS
Cordova
DOM
DPI
DanfoJS
DataFrame
DataGrid
Deno
DenoDOM
DexieJS
Dojo
Downloadify
Drash
Duktape
ERP
ES3
ES5
ES6
ESBuild
ESM
ETH
Eleventy
ElysiaJS
Endian
Ethercalc
ExecJS
ExpressJS
ExtendScript
Fastify
FastifyJS
Fastmail
FerretDB
FileReader
FileReaderSync
FileSaver
GBK
GTX
GatsbyJS
Ghidra
GitHub
GitLab
Goja
GraalJS
Gradle
GraphQL
GraphiQL
HTML
HTML5
HTTP
HTTPS
HappyDOM
Homebrew
HonoJS
IANA
IE
IE10
IE11
IE6
IE8
IE9
IMAP
InDesign
IndexedDB
Integrations
JDK
JE
JS
JSC
JSDOM
JSX
JWT
JavaScriptCore
Javet
JerryScript
Knex
Jint
Kaioken
Kaioponent
Kaioponents
KeyDB
KnexJS
KnockoutJS
LLC
LTS
LWC
LangChain
LangChainJS
Lifecycle
LocalStorage
LowDB
Lume
MUI
MVC
MVVM
MacOS
@ -211,7 +258,9 @@ MariaDB
Mathematica
Meridiem
MongoDB
MuJS
MySQL
NASM
NPM
NW.js
Nashorn
@ -219,6 +268,7 @@ NativeScript
NestJS
NetSuite
NeutralinoJS
Nexe
NextJS
NoSQL
NodeJS
@ -227,14 +277,19 @@ Nunjucks
Nuxt
NuxtJS
OSA
OpenSSL
OpenJDK
PPI
ParcelJS
PhantomJS
PhoneGap
Photoshop
Polars
PostgreSQL
PouchDB
PowerShell
Preact
PreactJS
QuickJS
R1
R2
@ -244,15 +299,23 @@ RDBMS
README
RESTlets
RSS
RTX
ReactJS
Redis
RequireJS
RhinoJS
Roadmap
Rollup
RollupJS
Ryzen
S3
SDK
SMS
SMTP
SQLite
SSG
SSL
SSR
SWC
SWF
Schemas
@ -261,28 +324,38 @@ SessionStorage
Shift-JIS
SlimerJS
Snowpack
Stata
SuiteScript
SuiteScripts
Suitelets
SvelteJS
SvelteKit
SystemJS
Tauri
Temurin
TensorFlow
UI
UI5
UNPKG
URI
UTF-16
UTF-8
UUID
UXP
Uint8Array
V2
V8
VBScript
VRAM
VSCodium
Valkey
Vendoring
Vercel
Vite
ViteJS
VueJS
VueJS-friendly
WASM
WMR
WSL
WebAssembly
@ -291,7 +364,9 @@ WebKit
WebSQL
Webpack
Win10
Win11
XHR
XMLDOM
XMLHttpRequest
XP
Xcode
@ -320,7 +395,9 @@ frontmatter
globals
iOS
iWork
jQuery
javascript
jujutsu
lifecycle
localForage
macOS
@ -329,11 +406,13 @@ microcontrollers
middleware
minified
minifier
mitigations
namespace
natively
nodejs
npm
parsers
polychotomous
pre-built
pre-generated
prepend
@ -354,6 +433,7 @@ transpile
transpiled
transpiling
uncheck
uncomment
unidimensional
unminified
unpkg

@ -241,8 +241,8 @@ require([
#### Asynchronous Loading
When `async` is enabled, Dojo will only understand the name `xlsx`. The config
object can map package names to scripts:
When `async` is enabled, Dojo will only understand the name `xlsx`. `dojoConfig`
can map package names to scripts:
<CodeBlock language="html">{`\
<script>

@ -4,7 +4,7 @@ pagination_prev: getting-started/index
pagination_next: getting-started/examples/index
sidebar_position: 7
sidebar_custom_props:
summary: Load NodeJS-style modules using CommonJS or ESM
summary: Load NodeJS modules using CommonJS or ESM
---
import current from '/version.js';

@ -1029,7 +1029,7 @@ export default App;
:::note pass
The Android demo has been tested in Windows 10 and in macOS.
The Android demo has been tested in Windows and macOS.
:::

@ -20,8 +20,8 @@ a large language model to generate queries based on English language input. The
existing tooling supports CSV but does not support real spreadsheets.
In ["SheetJS Conversion"](#sheetjs-conversion), we will use SheetJS libraries to
generate CSV files for the LangChain CSV loader. These conversions can be run in
a preprocessing step without disrupting existing CSV workflows.
generate CSV files for the LangChainJS CSV loader. These conversions can be run
in a preprocessing step without disrupting existing CSV workflows.
In ["SheetJS Loader"](#sheetjs-loader), we will use SheetJS libraries in a
custom `LoadOfSheet` data loader to directly generate documents and metadata.
@ -79,14 +79,14 @@ Special thanks to:
:::note pass
This explanation was verified against LangChain 0.2.
This explanation was verified against LangChainJS 0.2.
:::
Document loaders generate data objects ("documents") and associated metadata
from data sources.
LangChain offers a `CSVLoader`[^1] component for loading CSV data from a file:
LangChainJS offers a `CSVLoader`[^1] component for loading CSV data from a file:
```js title="Generating Documents from a CSV file"
import { CSVLoader } from "@langchain/community/document_loaders/fs/csv";
@ -131,7 +131,7 @@ Index: 44
</td></tr></tbody>
</table>
The LangChain CSV loader will include source metadata in the document:
The LangChainJS CSV loader will include source metadata in the document:
```js title="Document generated by the CSV loader"
Document {
@ -143,7 +143,7 @@ Document {
## SheetJS Conversion
The [SheetJS NodeJS module](/docs/getting-started/installation/nodejs) can be
imported in NodeJS scripts that use LangChain and other JavaScript libraries.
imported in NodeJS scripts that use LangChainJS and other JavaScript libraries.
A simple pre-processing step can convert workbooks to CSV files that can be
processed by the existing CSV tooling:
@ -330,9 +330,9 @@ console.log(docs);
## SheetJS Loader
The `CSVLoader` that ships with LangChain does not add any Document metadata and
does not generate any attributes. A custom loader can work around limitations in
the CSV tooling and potentially include metadata that has no CSV equivalent.
The LangChainJS `CSVLoader` does not add any Document metadata and does not
generate any attributes. A custom loader can work around limitations in the CSV
tooling and potentially include metadata that has no CSV equivalent.
```mermaid
flowchart LR
@ -449,7 +449,7 @@ export default class LoadOfSheet extends BufferLoader {
### From Text to Binary
Many libraries and platforms offer generic "text" loaders that process files
assuming the UTF8 encoding. This corrupts many spreadsheet formats including
assuming the UTF-8 encoding. This corrupts many spreadsheet formats including
XLSX, XLSB, XLSM and XLS.
:::note pass
@ -467,7 +467,7 @@ path to the workbook file from internal identifiers.
:::
The `CSVLoader` extends a special `TextLoader` that forces UTF8 text parsing.
The `CSVLoader` extends a special `TextLoader` that forces UTF-8 text parsing.
There is a separate `BufferLoader` class, used by the PDF loader, that passes
the raw data using NodeJS `Buffer` objects.

@ -42,7 +42,7 @@ This demo was tested in the following deployments:
|:-------------|:----------------|:-------|:-------|:-----------|
| `darwin-x64` | Duktape `2.7.0` | 2.2.1 | 3.12.2 | 2024-03-15 |
| `darwin-arm` | Duktape `2.7.0` | 2.2.2 | 3.12.3 | 2024-06-30 |
| `win10-x64` | Duktape `2.7.0` | 2.2.1 | 3.12.2 | 2024-03-25 |
| `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.3 | 2024-03-21 |
| `linux-arm` | Duktape `2.7.0` | 1.5.3 | 3.11.2 | 2024-06-20 |
@ -295,7 +295,7 @@ cd ..
```
</TabItem>
<TabItem value="win10-x64" label="Windows">
<TabItem value="win11-x64" label="Windows">
- Download and extract the source tarball. Commands must be run in WSL `bash`:
@ -314,7 +314,7 @@ cd duktape-2.7.0
- Edit `src\duk_config.h` and add the highlighted lines to the end of the file:
```c title="src\duk_config.h (add highlighted lines)"
```c title="src\duk_config.h (add highlighted lines to end of file)"
#endif /* DUK_CONFIG_H_INCLUDED */
// highlight-start
@ -362,7 +362,7 @@ cp duktape-*/libduktape.* .
```
</TabItem>
<TabItem value="win10-x64" label="Windows">
<TabItem value="win11-x64" label="Windows">
```cmd
copy duktape-2.7.0\duktape.dll .
@ -426,7 +426,7 @@ lib = "./libduktape.so.207.20700"
```
</TabItem>
<TabItem value="win10-x64" label="Windows">
<TabItem value="win11-x64" label="Windows">
The name of the library is `duktape.dll`:
@ -521,8 +521,8 @@ This demo was tested in the following deployments:
|:-------------|:----------------|:--------|:-------|:-----------|
| `darwin-x64` | Duktape `2.7.0` | 0.20.15 | 3.12.2 | 2024-03-15 |
| `darwin-arm` | Duktape `2.7.0` | 0.20.31 | 3.12.3 | 2024-06-30 |
| `win10-x64` | Duktape `2.7.0` | 0.20.16 | 3.12.2 | 2024-03-25 |
| `win10-arm` | Duktape `2.7.0` | 0.20.31 | 3.11.5 | 2024-06-20 |
| `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` | 0.20.16 | 3.11.3 | 2024-03-21 |
| `linux-arm` | Duktape `2.7.0` | 0.20.31 | 3.11.2 | 2024-06-20 |
@ -545,11 +545,25 @@ duk = CDLL(lib)
- Within the `export_df_to_wb` function, change the `df.to_json` line:
```python title="sheetjs.py (edit highlighted line)"
def export_df_to_wb(ctx, df, path, sheet_name="Sheet1", book_type=None):
# highlight-next-line
json = df.write_json()
```
:::note pass
**Polars made a breaking change in the `1.0` release.**
For `0.20` and earlier, the `row_oriented` option must be passed:
```python title="sheetjs.py (changes for Polars 0.20)"
def export_df_to_wb(ctx, df, path, sheet_name="Sheet1", book_type=None):
# highlight-next-line
json = df.write_json(row_oriented=True)
```
:::
2) Edit `SheetJSPandas.py`.
- In the `process` function, change `df.info()` to `df`:

@ -274,7 +274,7 @@ const exportFile = useCallback(() => {
#### Complete Component
This complete component example fetches a test file and displays the contents in
a HTML table. When the export button is clicked, a callback will export a file:
an HTML table. When the export button is clicked, a callback will export a file:
```jsx title="src/SheetJSReactAoO.js"
import React, { useCallback, useEffect, useState } from "react";
@ -528,7 +528,7 @@ The goal is to run SheetJS code in the browser. NextJS will attempt to render
pages on the server by default. `"use client";` instructs NextJS to treat the
exported component as a "Client Component" that will be rendered in the browser.
If the pragma is not added, NextJS will report errors related to hydration:
If the directive is not added, NextJS will report errors related to hydration:
```
Error: Hydration failed because the initial UI does not match what was rendered on the server.

@ -298,7 +298,7 @@ export class AppComponent {
#### Complete Component
This complete component example fetches a test file and displays the contents in
a HTML table. When the export button is clicked, a callback will export a file:
an HTML table. When the export button is clicked, a callback will export a file:
<Tabs groupId="ngVer">
<TabItem value="2" label="Angular 2-16">

@ -18,8 +18,8 @@ import CodeBlock from '@theme/CodeBlock';
data from spreadsheets.
This demo uses VueJS and SheetJS to process and generate spreadsheets. We'll
explore how to load SheetJS in a VueJS SFC (single-file component) and compare
common state models and data flow strategies.
explore how to load SheetJS in a VueJS single-file component and compare common
state models and data flow strategies.
:::note pass
@ -234,7 +234,7 @@ onMounted(async() => {
A component will typically map over the data with `v-for`[^3]. The following
example generates a TABLE with a row for each President:
```html title="Example SFC for displaying arrays of objects"
```html title="Example single-file component for displaying arrays of objects"
<script setup>
import { ref } from "vue";
const rows = ref([]);
@ -305,7 +305,7 @@ function exportFile() {
#### Complete Component
This complete component example fetches a test file and displays the contents in
a HTML table. When the export button is clicked, a callback will export a file:
an HTML table. When the export button is clicked, a callback will export a file:
```html title="src/SheetJSVueAoO.vue"
<script setup>

@ -76,7 +76,7 @@ and return a SheetJS workbook object[^2].
This controller fetches [a sample file](https://docs.sheetjs.com/pres.xlsx),
parses the result into a workbook, extracts the first worksheet, and uses the
SheetJS [`sheet_to_html`](/docs/api/utilities/html#html-table-output) method to
generate a HTML table:
generate an HTML table:
```js title="Sample Controller"
/* The controller function must accept a `$http` argument */

@ -97,7 +97,7 @@ was the latest version available on the Google CDN.
When fetching spreadsheets with XHR, `handleAs: "arraybuffer"` yields an
`ArrayBuffer` which can be passed to the SheetJS `read` method.
The following example generates a HTML table from the first worksheet:
The following example generates an HTML table from the first worksheet:
```html
<div id="tbl"></div>

@ -51,7 +51,7 @@ The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone)
comply with AMD `define` semantics. They support RequireJS and the `r.js`
optimizer out of the box.
### Config
### Configuration
The RequireJS config should set the `xlsx` alias in the `paths` property.

@ -578,7 +578,7 @@ function SheetJSSuperAgentUL() {
## NodeJS Demos
These examples show how to upload data in NodeJS.
These examples show how to upload data in NodeJS scripts.
### fetch

@ -240,7 +240,7 @@ The terminal will display the worksheet data in an array of arrays:
[["Name","Index"],["Bill Clinton",42],["GeorgeW Bush",43],["Barack Obama",44],["Donald Trump",45],["Joseph Biden",46]]
```
[^1]: See ["parseBody()"](https://hono.dev/docs/api/request#parsebody) in the HonoJS documentation.
[^1]: See ["`parseBody()`"](https://hono.dev/docs/api/request#parsebody) in the HonoJS documentation.
[^2]: See [`read` in "Reading Files"](/docs/api/parse-options)
[^3]: See [`sheet_to_csv` in "Utilities"](/docs/api/utilities/csv#delimiter-separated-output)
[^4]: See [`write` in "Writing Files"](/docs/api/write-options)

@ -187,7 +187,7 @@ npx @nestjs/cli start
:::note pass
In the most recent test, the process failed with a message referencing Multer:
In the most recent test, the process failed with a message referencing `Multer`:
```
src/sheetjs/sheetjs.controller.ts:9:54 - error TS2694: Namespace 'global.Express' has no exported member 'Multer'.

@ -101,8 +101,8 @@ fastify.post('/', async(req, reply) => {
:::caution pass
Out of the box, Fastify will return an error `FST_ERR_CTP_BODY_TOO_LARGE` when
processing large spreadsheets (`statusCode 413`). This is a Fastify issue.
Out of the box, FastifyJS will return an error `FST_ERR_CTP_BODY_TOO_LARGE` when
processing large spreadsheets (`statusCode 413`). This is a FastifyJS issue.
The default body size limit (including all uploaded files and fields) is 1 MB.
It can be increased by setting the `bodyLimit` option during server creation:

@ -135,7 +135,7 @@ This demo was tested in the following environments:
:::
0) Create a new project with a ESM-enabled `package.json`:
0) Create a new project with a `package.json` that enables ESM:
```bash
mkdir sheetjs-worker

@ -286,7 +286,7 @@ This demo reads PST mailboxes. Due to browser limitations, PST files larger than
100 MB may crash the browser.
After parsing the PST file, the "Attachments" table will list attached XLSX and
XLS spreadsheets in the file. The "preview" link will display a HTML table with
XLS spreadsheets in the file. The "preview" link will display an HTML table with
the data in the spreadsheet. The "download" link will download the attachment.
The [test file](pathname:///pst/enron.pst) was based on the EDRM clean extract

@ -206,11 +206,11 @@ await browser.close();`}
:::note Tested Deployments
This demo was last tested on 2024 June 24 against deno-puppeteer 16.2.0.
This demo was last tested on 2024 June 24 against `deno-puppeteer` 16.2.0.
:::
1) Install deno-puppeteer:
1) Install `deno-puppeteer`:
```bash
env PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@16.2.0/install.ts

@ -31,7 +31,7 @@ web browser. ["Browser Automation"](/docs/demos/net/headless) includes demos.
## Integration Details
Synthetic DOM implementations typically provide a function that accept a HTML
Synthetic DOM implementations typically provide a function that accept an HTML
string and return an object that represents `document`. An API method such as
`getElementsByTagName` or `querySelector` can pull TABLE elements.

@ -141,7 +141,7 @@ The following example JSX shows a table using HTML and using MUI components:
### Exporting Data
The SheetJS `table_to_book` method[^3] can parse data from a DOM element.
The MUI `Table` element is really a HTML TABLE element under the hood. A `ref`
The MUI `Table` element is really an HTML TABLE element under the hood. A `ref`
attached to the `Table` element can be processed by `table_to_book`.
The following snippet uses the `writeFileXLSX` method[^4] to generate and

@ -69,9 +69,9 @@ flowchart LR
aoo --> |app.js\nfrontend code| html
```
### ESBuild Config
### ESBuild Configuration
Plugins can be referenced in the `plugins` array of the build config object:
Plugins can be referenced in the `plugins` array of the build configuration:
```js title="build.mjs (structure)"
import * as esbuild from 'esbuild'

@ -55,7 +55,7 @@ flowchart LR
aoo --> |src/index.js\nfrontend code| html
```
### Webpack Config
### Webpack Configuration
The Webpack configuration is normally saved to `webpack.config.js`.

@ -597,7 +597,7 @@ curl -LO https://docs.sheetjs.com/next/sheetjs.xlsx
:::note pass
The `next@13.5.6` depefndency can be adjusted to pick a different version. For
The `next@13.5.6` dependency can be adjusted to pick a different version. For
example, NextJS `12.3.4` is installed with
<CodeBlock language="bash">{`\
@ -859,7 +859,7 @@ page was removed.
[^7]: See [`getStaticProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props) in the NextJS documentation.
[^8]: See [`getStaticPaths`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-paths) in the NextJS documentation.
[^9]: See [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props) in the NextJS documentation.
[^10]: See [`fallback` in getStaticPaths](https://nextjs.org/docs/pages/api-reference/functions/get-static-paths#fallback-false) in the NextJS documentation.
[^10]: See [`fallback` in `getStaticPaths`](https://nextjs.org/docs/pages/api-reference/functions/get-static-paths#fallback-false) in the NextJS documentation.
[^11]: See [`sheet_to_html` in "Utilities"](/docs/api/utilities/html#html-table-output)
[^12]: [`dangerouslySetInnerHTML`](https://react.dev/reference/react-dom/components/common#common-props) is a ReactJS prop supported for all built-in components.
[^13]: See [`sheet_to_json` in "Utilities"](/docs/api/utilities/array#array-output).

@ -65,7 +65,7 @@ This demo was tested in the following environments:
|:-----------|:--------------------|:---------|:-------------|:-----------|
| Android 34 | Pixel 3a | `8.7.2` | `darwin-arm` | 2024-06-09 |
| iOS 17.5 | iPhone SE (3rd gen) | `8.7.2` | `darwin-arm` | 2024-06-09 |
| Android 34 | Pixel 3a | `8.6.5` | `win10-x64` | 2024-04-07 |
| Android 35 | Pixel 9 | `8.8.3` | `win11-x64` | 2024-12-21 |
:::
@ -272,21 +272,25 @@ npx -p nativescript ns error-reporting disable
:::caution pass
When the demo was last tested, the latest version of the Android API was 34.
NativeScript did not support that API level. The exact error message from
`npx -p nativescript ns doctor ios` clearly stated supported versions:
In previous test runs, NativeScript did not support the latest Android API.
The error message from `npx -p nativescript ns doctor android` clearly stated
supported versions:
<pre>
<span {...r}></span> No compatible version of the Android SDK Build-tools are installed on your system. You can install any version in the following range: '&gt;=23 &lt;=33'.
</pre>
The SDK Platform `Android 13.0 ("Tiramisu")` was compatible with NativeScript.
Until NativeScript properly supports API level 34, "Tiramisu" must be used.
This requires installing the following packages from Android Studio:
If NativeScript does not properly supports the latest API level, a previous API
version should be installed using Android Studio.
In a previous test run, the following packages were required:
- `Android 13.0 ("Tiramisu")` API Level `33`
- `Android SDK Build-Tools` Version `33.0.2`
It is recommended to install the SDK Platform and corresponding Android SDK
Build-Tools for the latest supported API level.ß
:::
2) Test the local system configuration for Android development:
@ -586,9 +590,30 @@ If the emulator cannot be rooted, the following command works in macOS:
adb shell "run-as org.nativescript.SheetJSNS cat /data/user/0/org.nativescript.SheetJSNS/files/SheetJSNS.xls" > SheetJSNS.xls
```
:::caution pass
In the most recent `win11-x64` test, the generated file was corrupt. This is a
known issue with Windows redirects. The solution is to generate a Base64-encoded
string and decode using PowerShell:
```bash
adb shell "run-as org.nativescript.SheetJSNS base64 /data/user/0/org.nativescript.SheetJSNS/files/SheetJSNS.xls" > SheetJSNS.xls.b64
$b64 = Get-Content -Path .\SheetJSNS.xls.b64 -Raw
$bytes = [Convert]::FromBase64String($b64)
[System.IO.File]::WriteAllBytes("SheetJSNS.xls", $bytes)
```
:::
17) Open `SheetJSNS.xls` with a spreadsheet editor.
After the header row, insert a row with cell A2 = 0, B2 = SheetJS, C2 = Library:
After the header row, insert a row and make the following assignments:
- Set cell `A2` to `0`
- Set cell `B2` to `SheetJS` (type `'SheetJS` in the formula bar)
- Set cell `C2` to `Library` (type `'Library` in the formula bar)
After making the changes, the worksheet should look like the following:
```text
id | name | role
@ -609,7 +634,21 @@ If the emulator cannot be rooted, the following command works in macOS:
```bash
dd if=SheetJSNS.xls | adb shell "run-as org.nativescript.SheetJSNS dd of=/data/user/0/org.nativescript.SheetJSNS/files/SheetJSNS.xls"
```
```
:::caution pass
In the most recent `win11-x64` test, neither workaround worked. The solution is
to generate a Base64-encoded string and decode in `adb`. After closing Excel and
saving the `SheetJSNS.xls` file, run the following commands:
```bash
$bytes = [IO.File]::ReadAllBytes(".\SheetJSNS.xls")
$b64 = [Convert]::ToBase64String($bytes)
echo $b64 | adb shell "run-as org.nativescript.SheetJSNS base64 -d | run-as org.nativescript.SheetJSNS dd of=/data/user/0/org.nativescript.SheetJSNS/files/SheetJSNS.xls"
```
:::
19) Tap "Import File". A dialog will print the path of the file that was read.
The first item in the list will change.
@ -638,7 +677,13 @@ npx -p nativescript ns run ios
22) Open the file with a spreadsheet editor.
After the header row, insert a row with cell A2 = 0, B2 = SheetJS, C2 = Library:
After the header row, insert a row and make the following assignments:
- Set cell `A2` to `0`
- Set cell `B2` to `SheetJS` (type `'SheetJS` in the formula bar)
- Set cell `C2` to `Library` (type `'Library` in the formula bar)
After making the changes, the worksheet should look like the following:
```text
id | name | role

@ -77,7 +77,7 @@ cd ..
### Reading data
The QFile[^1] component presents an API reminiscent of File Input elements:
The `QFile`[^1] component presents an API reminiscent of File Input elements:
```html
<q-file label="Load File" filled label-color="orange" @input="updateFile"/>
@ -200,7 +200,7 @@ When prompted:
- "Package name": (press <kbd>Enter</kbd>, it will use the default `sheetjsquasar`)
- "Project product name": `SheetJSQuasar`
- "Project description": `SheetJS + Quasar`
- "Author": (press <kbd>Enter</kbd>, it will use your Git config settings)
- "Author": (press <kbd>Enter</kbd>, it will use Git settings)
- "Pick a Vue component style": `Composition API`
- "Pick your CSS preprocessor": `None`
- "Check the features needed for your project": Deselect everything (scroll down to each selected item and press <kbd>Space</kbd>)
@ -512,7 +512,7 @@ in your path, or install Android Studio
[Gradle](https://gradle.org/) (the complete version) must be extracted and the
`bin` folder must be added to the user PATH variable. After adding to PATH,
launch a new PowerShell or CMD window and run the command.
launch a new PowerShell or Command Prompt window and run the command.
:::

@ -504,7 +504,7 @@ or on your system to install the gradle wrapper. Please include gradle
in your path or install Android Studio
```
On macOS, this issue was resolved by installing gradle with Homebrew manager:
On macOS, this issue was resolved by installing Gradle with Homebrew manager:
```bash
brew install gradle

@ -55,7 +55,7 @@ This demo was tested in the following environments:
| iOS 17.5 | iPhone 15 Pro Max | `6.0.0` / `6.0.0` | `darwin-x64` | 2024-06-02 |
| Android 34 | Pixel 3a | `6.0.0` / `6.0.0` | `darwin-arm` | 2024-06-02 |
| iOS 17.5 | iPhone 15 Pro Max | `6.0.0` / `6.0.0` | `darwin-arm` | 2024-06-02 |
| Android 34 | Pixel 3a | `6.0.0` / `6.0.0` | `win10-x64` | 2024-05-28 |
| Android 35 | Pixel 9 | `6.2.0` / `6.0.2` | `win11-x64` | 2024-12-21 |
:::
@ -93,7 +93,7 @@ activated, CapacitorJS will show a file picker. After the user selects a file,
the element will receive a `change` event.
The following example parses the selected file using the SheetJS `read`[^1]
method, generates a HTML table from the first sheet using `sheet_to_html`[^2],
method, generates an HTML table from the first sheet using `sheet_to_html`[^2],
and displays the table by setting the `innerHTML` attribute of a `div` element:
```html title="Sample component for data import"
@ -128,7 +128,7 @@ Starting from a SheetJS workbook object[^3], the `write` method with the option
The `@capacitor/filesystem` plugin can write Base64 strings to the device.
The following example uses the SheetJS `table_to_book` method[^5] to create a
workbook object from a HTML table. The workbook object is exported to the XLSX
workbook object from an HTML table. The workbook object is exported to the XLSX
format and written to the device.
```html title="Sample component for data export"
@ -313,32 +313,24 @@ the "Documents" folder to find `SheetJSCap.xlsx`.
<details open>
<summary><b>Downloading the generated file</b> (click to hide)</summary>
`adb` must be run from the root user:
```bash
adb root
```
The file location can be found by searching for `SheetJSCap.xlsx`:
```bash
adb exec-out find / -name SheetJSCap.xlsx
```
The first line of the output starting with `/` is the desired path:
There may be a number of error messages that start with `find:`. There will be
at least one line starting with `/`:
```text
find: /proc/8533/task/8533/exe: No such file or directory
find: /proc/8533/exe: No such file or directory
// highlight-next-line
/data/media/0/Documents/SheetJSCap.xlsx
/storage/emulated/0/Documents/SheetJSCap.xlsx
```
`adb pull` can download the file:
The `/storage` path can be pulled using `adb pull`:
```bash
adb pull "/data/media/0/Documents/SheetJSCap.xlsx" SheetJSCap.xlsx
adb pull "/storage/emulated/0/Documents/SheetJSCap.xlsx" SheetJSCap.xlsx
```
`SheetJSCap.xlsx` can be opened with a spreadsheet editor such as Excel.

@ -496,7 +496,7 @@ flutter pub add http csv flutter_js
:::info pass
The command may fail in Windows with the followimg message:
The command may fail in Windows with the following message:
<pre {...r}>
Building with plugins requires symlink support.

@ -33,7 +33,7 @@ app to read and write workbooks. The app will look like the screenshots below:
<th><a href="#complete-example">Linux</a></th>
</tr></thead><tbody><tr><td>
![Windows screenshot](pathname:///wails/win10.png)
![Windows screenshot](pathname:///wails/win11.png)
</td><td>
@ -299,7 +299,7 @@ This demo was tested in the following environments:
|:---------------|:-------------|:---------|:-----------|
| macOS 14.4 | `darwin-x64` | `v2.8.0` | 2024-03-15 |
| macOS 14.5 | `darwin-arm` | `v2.8.2` | 2024-05-28 |
| Windows 10 | `win10-x64` | `v2.8.0` | 2024-03-24 |
| 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.8.0` | 2024-03-21 |
| Linux (Debian) | `linux-arm` | `v2.8.2` | 2024-05-28 |

@ -37,7 +37,7 @@ app to read and write workbooks. The app will look like the screenshots below:
<th><a href="#complete-example">Linux</a></th>
</tr></thead><tbody><tr><td>
![Windows screenshot](pathname:///tauri/win10.png)
![Windows screenshot](pathname:///tauri/win11.png)
</td><td>
@ -54,16 +54,24 @@ app to read and write workbooks. The app will look like the screenshots below:
The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be
installed and imported from JavaScript code.
:::info pass
The following explanation applies to Tauri 1.
The `allowlist` security model was abandoned in Tauri 2.
:::
:::note pass
Tauri currently does not provide the equivalent of NodeJS `fs` module. The raw
Tauri 1.x does not provide the equivalent of NodeJS `fs` module. The raw
`@tauri-apps/api` methods used in the examples are not expected to change.
:::
For security reasons, Tauri apps must explicitly enable system features.[^1]
They are enabled in `src-tauri/tauri.conf.json` in the `allowlist` subsection of
the `tauri` section of the config.
the `tauri` section of the configuration file.
- The `fs` entitlement[^2] enables reading and writing file data.
@ -346,7 +354,7 @@ This demo was tested in the following environments:
|:---------------|:-------------|:----------|:-----------|
| macOS 14.4 | `darwin-x64` | `v1.5.11` | 2024-04-20 |
| macOS 14.5 | `darwin-arm` | `v1.5.14` | 2024-05-26 |
| Windows 10 | `win10-x64` | `v1.5.11` | 2024-03-24 |
| 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.5.11` | 2024-03-21 |
| Linux (Debian) | `linux-arm` | `v1.5.14` | 2024-05-28 |
@ -361,7 +369,7 @@ This demo was tested in the following environments:
At a high level, the following software is required for building Tauri apps:
- a native platform-specific C/C++ compiler (for example, macOS requires Xcode)
- a browser engine integration (for example, linux requires `webkit2gtk`)
- a browser engine integration (for example, Linux requires `webkit2gtk`)
- [Rust](https://www.rust-lang.org/tools/install)
The platform configuration can be verified by running:
@ -401,7 +409,7 @@ build step will correctly detect the platform architecture.
<TabItem value="vuejs" label="VueJS">
```bash
npm create tauri-app@latest -- -m npm -t vue-ts SheetJSTauri -y
npm create tauri-app@3.x -- -m npm -t vue-ts SheetJSTauri -y
```
</TabItem>
@ -415,7 +423,7 @@ TypeScript template and manually wires Kaioken
:::
```bash
npm create tauri-app@latest -- -m npm -t vanilla-ts SheetJSTauri -y
npm create tauri-app@3.x -- -m npm -t vanilla-ts SheetJSTauri -y
```
</TabItem>
@ -639,6 +647,22 @@ The following features should be manually verified:
:::note pass
In some tests, the build failed with the error message:
```
Search string not found: "/supportedTSExtensions = .*(?=;)/"
```
This is a known issue with `vue-tsc`. The dependency must be upgraded:
```bash
npm install vue-tsc@latest
```
:::
:::note pass
During the last Linux ARM64 test, the build failed to create an AppImage:
```

@ -943,7 +943,7 @@ In some test runs, the development mode app failed with a "bundle URL" error:
> No bundle URL present.
The ["Production" section](#production) section covers release builds and tests.
The ["Production"](#production) section covers release builds and tests.
:::

@ -26,7 +26,7 @@ spreadsheets and converting to other formats.
:::caution pass
With the official release of [NodeJS SEA](/docs/demos/cli/nodesea), Vercel opted
to deprecate `pkg`. It is still useful for deploying apps embedding NodeJS v18
to deprecate `pkg`. It is still useful for deploying apps with NodeJS version 18
or earlier since those versions do not support NodeJS SEA.
:::

@ -127,7 +127,7 @@ npx boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli.exe -n 16.20.2
:::info pass
The Windows 10 build requires Visual Studio with "Desktop development with C++"
The Windows builds require Visual Studio with "Desktop development with C++"
workload, Python 3.11, and NASM[^2].
**The build command must be run in "x64 Native Tools Command Prompt"**

@ -147,7 +147,7 @@ function SheetJSQLWriter() {
Query builders are designed to simplify query generation and normalize field
types and other database minutiae.
**Knex**
**KnexJS**
**[The exposition has been moved to a separate page.](/docs/demos/data/knex)**

@ -427,7 +427,9 @@ correct host name and port number.
- If the server expects a different username and password, uncomment the `user`
and `password` lines and replace the values with the username and password.
- For Ubuntu/Debian PostgreSQL installations, the default user is `postgres`. The password must be set during installation or using `sudo -u postgres psql` followed by `\password postgres` in the psql prompt.
- For Ubuntu/Debian PostgreSQL installations, the default user is `postgres`.
The password must be set during installation or using `sudo -u postgres psql`
followed by `\password postgres` in the `psql` prompt.
7) Run the script:
@ -492,7 +494,9 @@ correct host name and port number.
- If the server expects a different username and password, uncomment the `user`
and `password` lines and replace the values with the username and password.
- For Ubuntu/Debian PostgreSQL installations, the default user is postgres. The password must be set during installation or using sudo -u postgres psql followed by \password postgres in the psql prompt.
- For Ubuntu/Debian PostgreSQL installations, the default user is postgres.
The password must be set during installation or using `sudo -u postgres psql`
followed by `\password postgres` in the `psql` prompt.
11) Fetch the example file [`pres.numbers`](https://docs.sheetjs.com/pres.numbers):

@ -57,7 +57,7 @@ from the SheetJS `read` or `readFile` methods[^4].
#### Exporting Data
`Collection#find`[^5] can pull an array of objects from a Mongo Collection.
`Collection#find`[^5] can pull an array of objects from a MongoDB Collection.
The SheetJS `json_to_sheet` method[^6] can take the result and generate a
worksheet object.

@ -60,7 +60,7 @@ possible to store complete databases in a single worksheet.
:::note pass
[`SheetJSRedis.mjs`](pathname:///nosql/SheetJSRedis.mjs) exports the methods:
- `redis_to_ws` creates a SheetJS worksheet by querying a redis client
- `redis_to_ws` creates a SheetJS worksheet by querying a Redis client
- `ws_to_redis` creates an array of query objects from the SheetJS worksheet
:::

@ -12,8 +12,8 @@ import CodeBlock from '@theme/CodeBlock';
Reading from and writing to files requires native platform support.
SheetJS `readFile` and `writeFile` methods include support for some platforms.
Due to sandboxing and security settings, `readFile` does not work in the web
browser and `writeFile` is not guaranteed to work in all cases.
Due to sandbox and security settings, `readFile` does not work in web browsers
and `writeFile` is not guaranteed to work in all cases.
This demo looks at various web APIs for reading and writing files. We'll explore
how to pass data between SheetJS functions and various APIs.

@ -37,8 +37,8 @@ Consider the following array of objects of data:
]
```
Storage API expects values to be strings. The simplest approach is to stringify
row objects using `JSON.stringify` and store using the row index as a key:
Storage API expects values to be strings. The simplest approach is to generate
strings using `JSON.stringify` and store using the row index as a key:
| Key | Value |
|:---:|:-------------------------------------|

@ -142,8 +142,8 @@ Clipboard data can be written from a `copy` event.
The event `clipboardData` property has a `setData` method which accepts a string
that can be generated using `type: "string"` in the SheetJS `write` method[^3].
The following example generates a HTML string from the first sheet of a workbook
object and loads the string into the HTML clipboard:
The following example generates an HTML string from the first sheet of a SheetJS
workbook object and loads the string into the HTML clipboard:
```js
document.oncopy = function(e) {

@ -76,7 +76,7 @@ In older versions of SuiteScript, references should omit the `.js` extension.
:::
For example, if the script `xlsx.full.min.js` was placed in the `SuiteScripts`
top-level directory, the config should use `"/SuiteScripts/xlsx.full.min.js"`:
top-level folder, `xlsx` should be mapped to `/SuiteScripts/xlsx.full.min.js`:
```json title="JsLibraryConfig.json"
{
@ -88,7 +88,7 @@ top-level directory, the config should use `"/SuiteScripts/xlsx.full.min.js"`:
```
Relative references are also supported. If the entire project is stored in one
folder, the config can use `"./xlsx.full.min.js"`:
folder, `xlsx` should be mapped to `"./xlsx.full.min.js"`:
```json title="JsLibraryConfig.json"
{
@ -306,7 +306,7 @@ var field = form.addField({
```
Since the `id` of the file field is `uploaded_file`, the request handler can
access the file at at `context.request.files["uploaded_file"]`
access the file at `context.request.files["uploaded_file"]`
:::

@ -196,7 +196,7 @@ A new Excel window with the loaded add-in will launch.
:::caution pass
In some tests, the taskpane showed an error:
In some tests, the task pane showed an error:
```
Script error.

@ -41,7 +41,7 @@ loaded in NodeJS scripts, including scripts invoked using the `"NodeJS"` mode
of the `ExternalEvaluate`[^1] Mathematica function.
However, the current cross-platform recommendation involves a dedicated command
line tool that leverages SheetJS libraries to to perform spreadsheet processing.
line tool that leverages SheetJS libraries to perform spreadsheet processing.
### External Engines

@ -9,6 +9,8 @@ sidebar_custom_props:
---
import current from '/version.js';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
[MATLAB](https://www.mathworks.com/products/matlab.html) is a numeric computing
@ -28,7 +30,7 @@ This demo was tested by SheetJS users in the following deployments:
| Architecture | Version | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | R2024a | 2024-06-09 |
| `win10-x64` | R2024a | 2024-06-09 |
| `win11-x64` | R2024b | 2024-12-21 |
:::
@ -136,7 +138,7 @@ flowchart LR
xlsx --> |`readtable`\nMATLAB| data
```
### Write Files
### Writing Files
Starting from an MATLAB table, `writetable` can generate a XLSX workbook. Once
the workbook is written, `xlsx-cli` can translate to NUMBERS or other formats:
@ -167,12 +169,6 @@ flowchart LR
## Complete Demo
:::info pass
This demo was tested in macOS. The path names will differ in other platforms.
:::
This demo processes [`pres.numbers`](https://docs.sheetjs.com/pres.numbers).
There are 3 parts to the demo:
@ -199,51 +195,96 @@ flowchart LR
```
1) Create the standalone `xlsx-cli` binary[^7]:
0) Launch MATLAB and run the following command to print the workspace folder:
```matlab
pwd
```
This folder is typically `MATLAB` with the `Documents` folder for the account.
1) Open a new macOS Terminal or Windows PowerShell window.
2) Navigate to the workspace folder displayed in Step 0.
<Tabs groupId="os">
<TabItem value="win" label="Windows">
In Windows, the folder is typically `C:\Users\username\Documents\MATLAB`. Since
PowerShell sessions start from the user folder, the command is:
```bash
cd Documents\MATLAB
```
</TabItem>
<TabItem value="mac" label="macOS">
In macOS, the folder is typically `~/Documents/MATLAB` so the command is:
```bash
cd ~/Documents/MATLAB
```
</TabItem>
</Tabs>
1) Create the standalone `xlsx-cli` binary[^7]. The following commands should be
run in the macOS Terminal or Windows PowerShell:
<CodeBlock language="bash">{`\
cd /tmp
npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz exit-on-epipe commander@2
curl -LO https://docs.sheetjs.com/cli/xlsx-cli.js
npx nexe -t 14.15.3 xlsx-cli.js`}
</CodeBlock>
2) Move the generated `xlsx-cli` to the MATLAB workspace folder. On macOS, this
folder is typically `~/Documents/MATLAB/`:
2) Download https://docs.sheetjs.com/pres.numbers to the workspace folder:
```bash
mkdir -p ~/Documents/MATLAB/
mv xlsx-cli ~/Documents/MATLAB/
```
3) Download https://docs.sheetjs.com/pres.numbers and save to Downloads folder:
```bash
cd ~/Downloads/
curl -LO https://docs.sheetjs.com/pres.numbers
```
4) Save the following to `SheetJSMATLAB.m` in the workspace folder:
<Tabs groupId="os">
<TabItem value="win" label="Windows">
```matlab title="SheetJSMATLAB.m"
% Import data from NUMBERS file
system("./xlsx-cli --xlsx ~/Downloads/pres.numbers");
tbl = readtable("~/Downloads/pres.numbers.xlsx");
system(".\xlsx-cli.exe --xlsx pres.numbers");
tbl = readtable("pres.numbers.xlsx");
% Process data (reverse sort)
sorted = sortrows(tbl,"Index", "descend");
% Export data to XLSB workbook
writetable(sorted,"~/Downloads/sorted.xlsx");
system("./xlsx-cli --xlsb ~/Downloads/sorted.xlsx");
writetable(sorted,"sorted.xlsx");
system(".\xlsx-cli.exe --xlsb sorted.xlsx");
```
</TabItem>
<TabItem value="mac" label="macOS">
```matlab title="SheetJSMATLAB.m"
% Import data from NUMBERS file
system("./xlsx-cli --xlsx pres.numbers");
tbl = readtable("pres.numbers.xlsx");
% Process data (reverse sort)
sorted = sortrows(tbl,"Index", "descend");
% Export data to XLSB workbook
writetable(sorted,"sorted.xlsx");
system("./xlsx-cli --xlsb sorted.xlsx");
```
</TabItem>
</Tabs>
5) In a MATLAB desktop session, run the `SheetJSMATLAB` command:
```matlab
>> SheetJSMATLAB
```
It will create the file `sorted.xlsx.xlsb` in the `~/Downloads` folder. Open the
file and confirm that the table is sorted by Index in descending order:
It will create the file `sorted.xlsx.xlsb` in the MATLAB workspace folder. Open
the file and confirm that the table is sorted by Index in descending order:
```
Name Index
@ -260,7 +301,6 @@ If the `matlab` command is available on the system `PATH`, the "headless"
version of the command is:
```bash
cd ~/Documents/MATLAB
matlab -batch SheetJSMATLAB
```
@ -273,4 +313,3 @@ matlab -batch SheetJSMATLAB
[^5]: See [`system`](https://www.mathworks.com/help/matlab/ref/system.html) in the MATLAB documentation.
[^6]: See ["MATLAB Operators and Special Characters](https://www.mathworks.com/help/matlab/matlab_prog/matlab-operators-and-special-characters.html) in the MATLAB documentation.
[^7]: See ["Command-line Tools"](/docs/demos/cli) for more details.

@ -214,6 +214,6 @@ The result will show the data from `pres.numbers`
[^1]: See ["ExcelTools"](https://www.maplesoft.com/support/help/Maple/view.aspx?path=ExcelTools) in the Maple documentation.
[^2]: See [`read` in "Reading Files"](/docs/api/parse-options)
[^3]: See [`write` in "Writing Files"](/docs/api/write-options)
[^4]: See ["C OpenMaple and ExternalCalling Application Program Interface (API)"](https://www.maplesoft.com/support/help/maple/view.aspx?path=OpenMaple%2FC%2FAPI) in the Maple documentation.
[^4]: See ["C `OpenMaple` and `ExternalCalling` Application Program Interface (API)"](https://www.maplesoft.com/support/help/maple/view.aspx?path=OpenMaple%2FC%2FAPI) in the Maple documentation.
[^5]: In a PowerShell terminal window, run `wsl --install Ubuntu`
[^6]: See [the Visual Studio website](https://visualstudio.microsoft.com/#vs-section) for download links. In the Visual Studio Installer, install the "Desktop development with C++" workflow.

@ -496,7 +496,7 @@ cp bin/Release/net6.0/linux-arm64/publish/SheetJSJint .
</TabItem>
<TabItem value="win-x64" label="Windows x64">
For Windows 10 x64, the RID is `win-x64` and the command is:
For Windows 11 x64, the RID is `win-x64` and the command is:
```powershell
copy .\bin\Release\net6.0\win-x64\publish\SheetJSJint.exe .

@ -562,7 +562,7 @@ On ARM64, the commands must be run in a "ARM64 Native Tools Command Prompt".
The build sequence requires Python, which can be installed from the official
Windows installer[^7].
Visual Studio with "Desktop development with C++" workload and Cmake must be
Visual Studio with "Desktop development with C++" workload and CMake must be
installed[^8]. In addition, the following Spectre-mitigated libs must be added:
- MSVC C++ x64/x86 Spectre-mitigated libs (Latest)

@ -263,7 +263,7 @@ The HTML DOM parser[^1] will process `<a>` links in the table.
<details open>
<summary><b>Live Example</b> (click to hide)</summary>
This example uses `table_to_book` to generate a SheetJS workbook object from a
This example uses `table_to_book` to generate a SheetJS workbook object from an
HTML table. The hyperlink in the second row will be parsed as a cell-level link.
```jsx live

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

BIN
docz/static/tauri/win11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

BIN
docz/static/wails/win11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB