From 7f366322e762006b8bd9839cd4d2d63df76402e0 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Fri, 22 Sep 2023 02:32:55 -0400 Subject: [PATCH] cell --- .../01-installation/02-frameworks.md | 35 +++++++++++++++ .../docs/03-demos/01-frontend/07-angularjs.md | 4 +- docz/docs/03-demos/01-frontend/08-bundler.md | 43 ++++++++++--------- docz/docs/03-demos/01-frontend/09-legacy.md | 24 ++++++++--- docz/docs/03-demos/03-net/08-headless.md | 2 +- .../docs/03-demos/05-mobile/01-reactnative.md | 2 +- .../03-demos/05-mobile/02-nativescript.md | 4 +- docz/docs/03-demos/05-mobile/03-quasar.md | 4 +- docz/docs/03-demos/05-mobile/04-ionic.md | 2 +- docz/docs/03-demos/05-mobile/05-capacitor.md | 4 +- docz/docs/03-demos/06-desktop/02-nwjs.md | 4 +- .../docs/03-demos/06-desktop/05-neutralino.md | 39 +++++++++-------- .../03-demos/06-desktop/06-reactnative.md | 2 +- docz/docs/03-demos/06-desktop/09-cli.md | 6 ++- docz/docs/03-demos/07-data/19-alasql.md | 4 +- docz/docs/03-demos/09-cloud/01-salesforce.md | 7 +-- .../03-demos/32-extensions/02-chromium.md | 4 +- docz/docs/03-demos/32-extensions/04-gsheet.md | 12 ++++-- docz/docs/03-demos/32-extensions/06-osa.md | 14 ++++-- docz/docs/03-demos/37-bigdata/02-worker.md | 3 +- docz/docs/03-demos/42-engines/01_duktape.md | 7 +-- docz/docs/03-demos/42-engines/02_v8.md | 9 +++- docz/docs/03-demos/42-engines/03_rhino.md | 7 +-- docz/docs/03-demos/42-engines/04_jsc.md | 7 +-- docz/docs/03-demos/42-engines/05-jint.md | 3 +- docz/docs/03-demos/42-engines/06_goja.md | 9 ++-- docz/docs/03-demos/42-engines/07_nashorn.md | 7 +-- docz/docs/03-demos/42-engines/08_quickjs.md | 6 ++- docz/docs/03-demos/42-engines/09_hermes.md | 6 ++- docz/docs/03-demos/42-engines/14-pandas.md | 19 ++++---- docz/docs/03-demos/42-engines/15_rb.md | 7 +-- docz/docs/03-demos/42-engines/20_chakra.md | 10 +++-- docz/docs/03-demos/42-engines/21_boa.md | 10 +++-- docz/docs/03-demos/42-engines/index.md | 10 ++++- docz/docs/07-csf/02-cell.md | 8 +++- 35 files changed, 226 insertions(+), 118 deletions(-) diff --git a/docz/docs/02-getting-started/01-installation/02-frameworks.md b/docz/docs/02-getting-started/01-installation/02-frameworks.md index ec6c3d1..d739e32 100644 --- a/docz/docs/02-getting-started/01-installation/02-frameworks.md +++ b/docz/docs/02-getting-started/01-installation/02-frameworks.md @@ -182,6 +182,41 @@ var read = XLSX.read, utils = XLSX.utils; The ["Bundlers" demo](/docs/demos/bundler) includes examples for specific tools. +### Dynamic Imports + +Dynamic imports with `import()` will only download scripts when they are needed. + +:::warning pass + +Dynamic `import` will always download the full contents of the imported scripts! + +**This is a design flaw in ECMAScript modules** + +::: + +It is strongly recommended to use a wrapper script that imports and re-exports +the parts of the SheetJS library that are used in a specific function or page: + +```js title="SheetJSWriteWrapper.js (wrapper script)" +/* This wrapper pulls `writeFileXLSX` and `utils` from the SheetJS library */ +import { utils, writeFileXLSX } from "xlsx"; +export { utils, writeFileXLSX }; +``` + +A dynamic import of the wrapper script will only load the requested features: + +```js +async function export_data() { + /* dynamically import the SheetJS Wrapper */ + // highlight-next-line + const XLSX = await import ("./SheetJSWriteWrapper"); + const wb = XLSX.utils.book_new(); + const ws = XLSX.utils.aoa_to_sheet([["a","b","c"],[1,2,3]]); + XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); + XLSX.writeFileXLSX(wb, "SheetJSDynamicWrapperTest.xlsx"); +} +``` + ## Encoding support If Encoding support is required, `cpexcel.full.mjs` must be manually imported: diff --git a/docz/docs/03-demos/01-frontend/07-angularjs.md b/docz/docs/03-demos/01-frontend/07-angularjs.md index 99047df..ecf94d3 100644 --- a/docz/docs/03-demos/01-frontend/07-angularjs.md +++ b/docz/docs/03-demos/01-frontend/07-angularjs.md @@ -35,8 +35,8 @@ input element for loading user-submitted files. ## Installation -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -referenced in a `SCRIPT` tag from the HTML entrypoint page. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be referenced in a `SCRIPT` tag from the HTML entry point page. The `$http` service can request binary data using `"arraybuffer"` response type. This maps to the `"array"` input format for `XLSX.read`: diff --git a/docz/docs/03-demos/01-frontend/08-bundler.md b/docz/docs/03-demos/01-frontend/08-bundler.md index f463ea4..98ff783 100644 --- a/docz/docs/03-demos/01-frontend/08-bundler.md +++ b/docz/docs/03-demos/01-frontend/08-bundler.md @@ -17,7 +17,7 @@ practices have evolved, stress testing SheetJS libraries have revealed bugs in the respective bundlers. This demo collects various notes and provides basic examples. -:::note +:::note pass Issues should be reported to the respective bundler projects. Typically it is considered a bundler bug if the tool cannot properly handle JS libraries. @@ -374,7 +374,7 @@ node esb.node.js -:::note +:::note pass Bundling raw data is supported using the `binary` loader. For more advanced content workflows, [ViteJS](/docs/demos/static/vitejs) is the recommended tool. @@ -482,11 +482,10 @@ click the "Click to Export!" button to generate a file. ## RequireJS -[Standalone scripts](/docs/getting-started/installation/standalone) comply with AMD `define` -semantics, enabling use in RequireJS out of the box. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +comply with AMD `define` semantics. They support RequireJS out of the box. -To enable use of the alias `xlsx`, the RequireJS config should set an alias in -the `paths` property: +The RequireJS config should set the `xlsx` alias in the `paths` property: ```js require.config({ @@ -518,14 +517,18 @@ This demo was last tested on 2023 May 07 against RequireJS `2.3.3` ::: -:::caution +:::caution pass The `r.js` optimizer does not support ES6 syntax including arrow functions and the `async` keyword! The demo JS code uses traditional functions. ::: -0) Download the standalone build: +0) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} @@ -824,7 +827,7 @@ writeFileXLSX(workbook, "Presidents.xlsx"); ``` -:::note +:::note pass Unlike other bundlers, Snowpack requires a full page including `HEAD` element. @@ -885,7 +888,7 @@ yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`} regenerat -:::note +:::note pass The `regenerator-runtime` dependency is used for transpiling `fetch` and is not required if the interface code does not use `fetch` or Promises. @@ -980,7 +983,7 @@ Click on "Click here to export" to generate a file. With configuration, SystemJS supports both browser and NodeJS deployments. -:::caution +:::caution pass This demo was written against SystemJS 0.19, the most popular SystemJS version used with Angular applications. In the years since the release, Angular and @@ -1045,7 +1048,7 @@ _cb = function(evt) { /* ... do work here ... */ }; -:::caution +:::caution pass While SystemJS works in NodeJS, the built-in `require` should be preferred. @@ -1166,7 +1169,7 @@ node SheetJSystem.js If the demo worked, `Presidents.xlsx` will be created. -:::note +:::note pass As it uses `fetch`, this demo requires Node 18. @@ -1297,7 +1300,7 @@ set_cptable(cptable); ::: -:::caution +:::caution pass Some older webpack projects will throw an error in the browser: @@ -1306,7 +1309,7 @@ require is not defined (xlsx.mjs) ``` This was a bug in Webpack and affected projects built with `create-react-app`. -If upgrading Webpack is not feasible, explicitly import the standalone builds: +If upgrading Webpack is not feasible, explicitly import the standalone script: ```js import * as XLSX from 'xlsx/dist/xlsx.full.min.js'; @@ -1404,9 +1407,9 @@ module.exports = { -:::note +:::note pass -In Webpack 2.x and 3.x, the import statement must use the standalone build: +In Webpack 2.x and 3.x, the import statement must use the standalone script: ```js title="index.js" // highlight-next-line @@ -1429,7 +1432,7 @@ npx webpack@2.x -p npx webpack@3.x -p ``` -:::caution +:::caution pass The minifier that ships with Webpack 2.x does not handle `async` functions. The unminified code generated by Webpack will work for the purposes of the demo. It @@ -1450,7 +1453,7 @@ version above 4.0 can be pinned by locally installing webpack and the CLI tool. **Webpack 4.x** -:::note +:::info pass Webpack 4 is incompatible with Node 18+. When this demo was last tested, NodeJS was locally downgraded to 16.20.0 @@ -1504,7 +1507,7 @@ Click on "Click here to export" to generate a file. -:::note +:::note pass The [Webpack section of the Content demo](/docs/demos/static/webpack) covers asset loaders. They are ideal for static sites pulling data from sheets at build time. diff --git a/docz/docs/03-demos/01-frontend/09-legacy.md b/docz/docs/03-demos/01-frontend/09-legacy.md index 688ef90..f60833d 100644 --- a/docz/docs/03-demos/01-frontend/09-legacy.md +++ b/docz/docs/03-demos/01-frontend/09-legacy.md @@ -19,9 +19,22 @@ SheetJS libraries strive to maintain broad browser and JS engine compatibility. ## Integration -["Standalone Browser Scripts"](/docs/getting-started/installation/standalone) -section has instructions for obtaining or referencing the standalone scripts. -These are designed to be referenced with ` + + +`} + ## Internet Explorer @@ -39,14 +52,15 @@ IE, but there are approaches using ActiveX or Flash. This demo includes all of the support files for the Flash and ActiveX methods. -1) Download the standalone script and shim to a server that will host the demo: +1) Download the SheetJS Standalone script and shim script. Move both files to +the project directory: -2) [Download the demo ZIP](pathname:///ie/SheetJSIESupport.zip) to the server. +2) [Download the demo ZIP](pathname:///ie/SheetJSIESupport.zip). The ZIP includes the demo HTML file as well as the Downloadify support files. diff --git a/docz/docs/03-demos/03-net/08-headless.md b/docz/docs/03-demos/03-net/08-headless.md index 3541cd5..682693b 100644 --- a/docz/docs/03-demos/03-net/08-headless.md +++ b/docz/docs/03-demos/03-net/08-headless.md @@ -11,7 +11,7 @@ Headless automation involves controlling "headless browsers" to access websites and submit or download data. It is also possible to automate browsers using custom browser extensions. -The [SheetJS standalone script](/docs/getting-started/installation/standalone) +The [SheetJS standalone scripts](/docs/getting-started/installation/standalone) can be added to any website by inserting a `SCRIPT` tag. Headless browsers usually provide utility functions for running custom snippets in the browser and passing data back to the automation script. diff --git a/docz/docs/03-demos/05-mobile/01-reactnative.md b/docz/docs/03-demos/05-mobile/01-reactnative.md index 1ce14d6..3b48850 100644 --- a/docz/docs/03-demos/05-mobile/01-reactnative.md +++ b/docz/docs/03-demos/05-mobile/01-reactnative.md @@ -58,7 +58,7 @@ a sample app in the Android and the iOS (if applicable) simulators. ## Integration Details The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be -imported from the main `App.js` entrypoint or any script in the project. +imported from any component or script in the app. ### Internal State diff --git a/docz/docs/03-demos/05-mobile/02-nativescript.md b/docz/docs/03-demos/05-mobile/02-nativescript.md index 1d9b047..b45f2be 100644 --- a/docz/docs/03-demos/05-mobile/02-nativescript.md +++ b/docz/docs/03-demos/05-mobile/02-nativescript.md @@ -10,8 +10,8 @@ sidebar_custom_props: import current from '/version.js'; import CodeBlock from '@theme/CodeBlock'; -The [NodeJS Module](/docs/getting-started/installation/nodejs) can be imported -from the main entrypoint or any script in the project. +The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be +imported from any component or script in the app. The "Complete Example" creates an app that looks like the screenshots below: diff --git a/docz/docs/03-demos/05-mobile/03-quasar.md b/docz/docs/03-demos/05-mobile/03-quasar.md index 48a47e3..58d426f 100644 --- a/docz/docs/03-demos/05-mobile/03-quasar.md +++ b/docz/docs/03-demos/05-mobile/03-quasar.md @@ -39,8 +39,8 @@ The ["Demo"](#demo) creates an app that looks like the screenshots below: ## Integration Details -The [NodeJS Module](/docs/getting-started/installation/nodejs) can be imported -from the main entrypoint or any script in the project. +The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be +imported from any component or script in the app. This demo will use the Quasar ViteJS starter project with VueJS and Cordova. The starter places the backing Cordova project in the `src-cordova` folder. diff --git a/docz/docs/03-demos/05-mobile/04-ionic.md b/docz/docs/03-demos/05-mobile/04-ionic.md index c5d7b37..ba9b28d 100644 --- a/docz/docs/03-demos/05-mobile/04-ionic.md +++ b/docz/docs/03-demos/05-mobile/04-ionic.md @@ -74,7 +74,7 @@ npx @capacitor/cli telemetry ## Integration Details The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be -imported from the main entrypoint or any script in the project. +imported from any component or script in the app. ### Internal State diff --git a/docz/docs/03-demos/05-mobile/05-capacitor.md b/docz/docs/03-demos/05-mobile/05-capacitor.md index bd26b1c..c52e68a 100644 --- a/docz/docs/03-demos/05-mobile/05-capacitor.md +++ b/docz/docs/03-demos/05-mobile/05-capacitor.md @@ -10,8 +10,8 @@ sidebar_custom_props: import current from '/version.js'; import CodeBlock from '@theme/CodeBlock'; -The [NodeJS Module](/docs/getting-started/installation/nodejs) can be imported -from the main entrypoint or any script in the project. +The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be +imported from any component or script in the app. The "Complete Example" creates an app that looks like the screenshots below: diff --git a/docz/docs/03-demos/06-desktop/02-nwjs.md b/docz/docs/03-demos/06-desktop/02-nwjs.md index 9733276..2bdfa8f 100644 --- a/docz/docs/03-demos/06-desktop/02-nwjs.md +++ b/docz/docs/03-demos/06-desktop/02-nwjs.md @@ -12,8 +12,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -referenced in a `SCRIPT` tag from the entry point HTML page. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be referenced in a `SCRIPT` tag from the entry point HTML page. The "Complete Example" creates an app that looks like the screenshots below: diff --git a/docz/docs/03-demos/06-desktop/05-neutralino.md b/docz/docs/03-demos/06-desktop/05-neutralino.md index e173189..ae3c3e5 100644 --- a/docz/docs/03-demos/06-desktop/05-neutralino.md +++ b/docz/docs/03-demos/06-desktop/05-neutralino.md @@ -49,8 +49,8 @@ app to read and write workbooks. The app will look like the screenshots below: ## Integration Details -The [SheetJS Standalone build](/docs/getting-started/installation/standalone) -can be added to the entry `index.html` +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be added to the `index.html` entry point. For code running in the window, native methods must be explicitly enabled in the NeutralinoJS `neutralino.conf.json` settings file[^1]. @@ -197,6 +197,7 @@ This demo was tested in the following environments: | macOS 13.5.1 | x64 | `v4.13.0` | `v3.11.0` | 2023-08-26 | | macOS 13.4.1 | ARM | `v4.10.0` | `v3.8.2` | 2023-06-28 | | Windows 10 | x64 | `v4.13.0` | `v3.11.0` | 2023-08-26 | +| Windows 11 | ARM | `v4.13.0` | `v3.11.0` | 2023-09-21 | | Linux (HoloOS) | x64 | `v4.13.0` | `v3.11.0` | 2023-08-26 | ::: @@ -211,8 +212,12 @@ npx @neutralinojs/neu create sheetjs-neu cd sheetjs-neu ``` -2) Download [Standalone build](/docs/getting-started/installation/standalone) -and place in the `resources/js/` folder: +2) Download the SheetJS Standalone script and move to the `resources/js/` +subdirectory in the `sheetjs-neu` folder: + + {`\ curl -L -o resources/js/xlsx.full.min.js https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} @@ -238,9 +243,7 @@ line must be added to the first block. ::: -4) Set up skeleton app and print version info: - -- Replace the contents of `resources/index.html` with the following code: +4) Replace the contents of `resources/index.html` with the following code: ```html title="resources/index.html" @@ -265,9 +268,9 @@ line must be added to the first block. ``` -- Append the following code to `resources/styles.css` to center the table: +5) Append the following code to `resources/styles.css` to center the table: -```css title="resources/styles.css" +```css title="resources/styles.css (add to end)" #info { width:100%; text-align: unset; @@ -277,7 +280,7 @@ table { } ``` -- Print the version number in the `showInfo` method of `resources/js/main.js`: +6) Print the version number in the `showInfo` method of `resources/js/main.js`: ```js title="resources/js/main.js" function showInfo() { @@ -293,7 +296,7 @@ function showInfo() { } ``` -5) Run the app: +7) Run the app: ```bash npx @neutralinojs/neu run @@ -301,9 +304,9 @@ npx @neutralinojs/neu run

The app should print SheetJS Version {current}

-6) Add the following code to the bottom of `resources/js/main.js`: +8) Add the following code to the bottom of `resources/js/main.js`: -```js title="resources/js/main.js" +```js title="resources/js/main.js (add to end)" (async() => { const ab = await (await fetch("https://sheetjs.com/pres.numbers")).arrayBuffer(); const wb = XLSX.read(ab); @@ -312,13 +315,13 @@ npx @neutralinojs/neu run })(); ``` -Save the source file, close the app and re-run with `npx @neutralinojs/neu run` +9) Close the app and relaunch the app with `npx @neutralinojs/neu run` When the app loads, a table should show in the main screen. -7) Add `importFile` and `exportFile` to the bottom of `resources/js/main.js`: +10) Add `importFile` and `exportFile` to the bottom of `resources/js/main.js`: -```js title="resources/js/main.js" +```js title="resources/js/main.js (add to end)" async function importData() { /* show open dialog */ const [filename] = await Neutralino.os.showOpenDialog('Open a spreadsheet'); @@ -347,7 +350,7 @@ async function exportData() { } ``` -Save the source file, close the app and re-run with `npx @neutralinojs/neu run` +11) Close the app and re-run with `npx @neutralinojs/neu run` When the app loads, click the "Import File" button and select a spreadsheet to see the contents. @@ -361,7 +364,7 @@ save as `SheetJSNeu` will not automatically add the `.xlsx` extension! ::: -8) Build production apps: +12) Build production apps: ```bash npx @neutralinojs/neu build diff --git a/docz/docs/03-demos/06-desktop/06-reactnative.md b/docz/docs/03-demos/06-desktop/06-reactnative.md index b0b451a..c447da2 100644 --- a/docz/docs/03-demos/06-desktop/06-reactnative.md +++ b/docz/docs/03-demos/06-desktop/06-reactnative.md @@ -78,7 +78,7 @@ The recommended approach for suppressing telemetry is explicitly passing the ## Integration Details The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be -imported from the main `App.js` entrypoint or any script in the project. +imported from any component or script in the app. ### Internal State diff --git a/docz/docs/03-demos/06-desktop/09-cli.md b/docz/docs/03-demos/06-desktop/09-cli.md index 92c3579..61da845 100644 --- a/docz/docs/03-demos/06-desktop/09-cli.md +++ b/docz/docs/03-demos/06-desktop/09-cli.md @@ -265,7 +265,11 @@ curl -LO https://docs.sheetjs.com/cli/snapshot.rs curl -LO https://docs.sheetjs.com/cli/sheet2csv.rs ``` -2) Download the [standalone build](/docs/getting-started/installation/standalone): +2) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} diff --git a/docz/docs/03-demos/07-data/19-alasql.md b/docz/docs/03-demos/07-data/19-alasql.md index f593421..0bd8f6b 100644 --- a/docz/docs/03-demos/07-data/19-alasql.md +++ b/docz/docs/03-demos/07-data/19-alasql.md @@ -99,8 +99,8 @@ function SheetJSAlaSQL() { #### Standalone Scripts -The [Standalone scripts](/docs/getting-started/installation/standalone) should -be loaded before the `alasql` script: +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +should be loaded before the `alasql` script: {`\ diff --git a/docz/docs/03-demos/09-cloud/01-salesforce.md b/docz/docs/03-demos/09-cloud/01-salesforce.md index 61ae0e0..3577e39 100644 --- a/docz/docs/03-demos/09-cloud/01-salesforce.md +++ b/docz/docs/03-demos/09-cloud/01-salesforce.md @@ -117,9 +117,10 @@ should see a page like ## Adding the Standalone Script -The [standalone script](/docs/getting-started/installation/standalone) can be downloaded and -added as a static resource. Due to Salesforce naming restrictions, it will have -to be renamed to `sheetjs.js` when adding the static resource. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be downloaded and added as a static resource. + +Due to Salesforce name restrictions, the script must be renamed to `sheetjs.js`

1) Download https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.full.min.js

diff --git a/docz/docs/03-demos/32-extensions/02-chromium.md b/docz/docs/03-demos/32-extensions/02-chromium.md index ad1fbc2..793c2c4 100644 --- a/docz/docs/03-demos/32-extensions/02-chromium.md +++ b/docz/docs/03-demos/32-extensions/02-chromium.md @@ -12,8 +12,8 @@ will not accept new V2 extensions, but these can be sideloaded using the ::: -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -integrated in a Chromium extension. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be integrated in a Chromium extension. This demo includes examples for exporting bookmarks from a popup and scraping tables with a content script and a background script. diff --git a/docz/docs/03-demos/32-extensions/04-gsheet.md b/docz/docs/03-demos/32-extensions/04-gsheet.md index 1270bea..e75ce80 100644 --- a/docz/docs/03-demos/32-extensions/04-gsheet.md +++ b/docz/docs/03-demos/32-extensions/04-gsheet.md @@ -15,9 +15,9 @@ covers the API for NodeJS scripts ::: -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -uploaded into an Apps Script project. Once uploaded, the `XLSX` variable is -available to other scripts in the project. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be uploaded into an Apps Script project. Once uploaded, the `XLSX` variable +is available to other scripts in the project. Google Sheets currently does not provide support for working with Apple Numbers files and some legacy file formats. SheetJS fills the gap. @@ -138,7 +138,11 @@ and paste in the terminal. Press Enter after pasting the ID. ### Adding the SheetJS Library -7) Download the standalone build and move to the project directory: +7) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} diff --git a/docz/docs/03-demos/32-extensions/06-osa.md b/docz/docs/03-demos/32-extensions/06-osa.md index 541b93b..1b4abb1 100644 --- a/docz/docs/03-demos/32-extensions/06-osa.md +++ b/docz/docs/03-demos/32-extensions/06-osa.md @@ -14,9 +14,9 @@ Open Scripting Architecture (OSA), a built-in feature in macOS introduced in language and grammar. macOS releases starting from Yosemite (OSX 10.10) include native support for scripting with JavaScript. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated from the JS engine. Once evaluated, the `XLSX` variable is -available as a global. A JS stub can expose methods from AppleScript scripts. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated from the JS engine. Once evaluated, the `XLSX` +global will be defined. A JS stub can expose methods from AppleScript scripts. :::note @@ -144,7 +144,13 @@ extractResult(res) This example will read from a specified filename and print the first worksheet data in CSV format. -0) Download the standalone script and test file: +0) Download the SheetJS Standalone script and test file. Move both files to +the project directory: + + {`\ curl -LO https://sheetjs.com/pres.numbers diff --git a/docz/docs/03-demos/37-bigdata/02-worker.md b/docz/docs/03-demos/37-bigdata/02-worker.md index 00b6c2b..25b808e 100644 --- a/docz/docs/03-demos/37-bigdata/02-worker.md +++ b/docz/docs/03-demos/37-bigdata/02-worker.md @@ -123,7 +123,8 @@ const worker = new Worker("./worker.js"); ## Installation -In all cases, `importScripts` in a Worker can load the [Standalone scripts](/docs/getting-started/installation/standalone) +In all cases, `importScripts` in a Worker can load the +[SheetJS Standalone scripts](/docs/getting-started/installation/standalone) {`\ importScripts("https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js");`} diff --git a/docz/docs/03-demos/42-engines/01_duktape.md b/docz/docs/03-demos/42-engines/01_duktape.md index 874425e..0daeaa0 100644 --- a/docz/docs/03-demos/42-engines/01_duktape.md +++ b/docz/docs/03-demos/42-engines/01_duktape.md @@ -10,8 +10,8 @@ import CodeBlock from '@theme/CodeBlock'; Duktape is an embeddable JS engine written in C. It has been ported to a number of exotic architectures and operating systems. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a Duktape context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a Duktape context. ## Integration Details @@ -140,7 +140,8 @@ tar -xJf duktape-2.7.0.tar.xz mv duktape-2.7.0/src/*.{c,h} . ``` -1) Download the standalone script, shim and test file: +1) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
  • shim.min.js
  • diff --git a/docz/docs/03-demos/42-engines/02_v8.md b/docz/docs/03-demos/42-engines/02_v8.md index f484069..1a5a2e6 100644 --- a/docz/docs/03-demos/42-engines/02_v8.md +++ b/docz/docs/03-demos/42-engines/02_v8.md @@ -627,7 +627,8 @@ cl /MT /I..\v8\v8\ /I..\v8\v8\include hello-world.cc /GR- v8_monolith.lib Advapi ### Add SheetJS -12) Download the standalone script and test file: +12) Download the SheetJS Standalone script and test file. Save both files in +the project directory:
    • xlsx.full.min.js
    • @@ -743,7 +744,11 @@ cargo add v8 cargo run ``` -3) Download the [Standalone build](/docs/getting-started/installation/standalone): +3) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} diff --git a/docz/docs/03-demos/42-engines/03_rhino.md b/docz/docs/03-demos/42-engines/03_rhino.md index 6713ef7..3c4130a 100644 --- a/docz/docs/03-demos/42-engines/03_rhino.md +++ b/docz/docs/03-demos/42-engines/03_rhino.md @@ -9,8 +9,8 @@ import CodeBlock from '@theme/CodeBlock'; Rhino is an ES3+ engine in Java. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a Rhino context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a Rhino context. This demo wraps workbooks and sheets into separate Java classes. The final result is a JAR. @@ -134,7 +134,8 @@ cd sheetjs-java curl -L -o rhino.jar https://repo1.maven.org/maven2/org/mozilla/rhino/1.7.14/rhino-1.7.14.jar ``` -1) Download the standalone script and the test file: +1) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
      • xlsx.full.min.js
      • diff --git a/docz/docs/03-demos/42-engines/04_jsc.md b/docz/docs/03-demos/42-engines/04_jsc.md index 5fc2833..1cafc40 100644 --- a/docz/docs/03-demos/42-engines/04_jsc.md +++ b/docz/docs/03-demos/42-engines/04_jsc.md @@ -11,8 +11,8 @@ iOS and MacOS ship with the JavaScriptCore framework for running JS code from Swift and Objective-C. Hybrid function invocation is tricky, but explicit data passing is straightforward. The demo shows a standalone Swift sample for MacOS. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a JSC context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a JSC context. :::warning Platform Limitations @@ -153,7 +153,8 @@ mkdir sheetjswift cd sheetjswift ``` -1) Download the standalone script and the test file: +1) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
        • xlsx.full.min.js
        • diff --git a/docz/docs/03-demos/42-engines/05-jint.md b/docz/docs/03-demos/42-engines/05-jint.md index acf0780..994fc15 100644 --- a/docz/docs/03-demos/42-engines/05-jint.md +++ b/docz/docs/03-demos/42-engines/05-jint.md @@ -243,7 +243,8 @@ The terminal should display `Hello SheetJS` ### Add SheetJS -5) Download the standalone script, shim and test file: +5) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
          • xlsx.full.min.js
          • diff --git a/docz/docs/03-demos/42-engines/06_goja.md b/docz/docs/03-demos/42-engines/06_goja.md index 5e99b08..9d3cb28 100644 --- a/docz/docs/03-demos/42-engines/06_goja.md +++ b/docz/docs/03-demos/42-engines/06_goja.md @@ -9,8 +9,8 @@ import CodeBlock from '@theme/CodeBlock'; Goja is a pure Go implementation of ECMAScript 5. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a Goja context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a Goja context. ## Integration Details @@ -114,7 +114,8 @@ go mod init SheetGoja go get github.com/dop251/goja ``` -1) Download the standalone script, shim and test file: +1) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
            • xlsx.full.min.js
            • @@ -134,7 +135,7 @@ curl -LO https://sheetjs.com/pres.numbers`} curl -LO https://docs.sheetjs.com/goja/SheetGoja.go ``` -3) Build standalone `SheetGoja` binary: +3) Build the standalone `SheetGoja` binary: ```bash go build SheetGoja.go diff --git a/docz/docs/03-demos/42-engines/07_nashorn.md b/docz/docs/03-demos/42-engines/07_nashorn.md index 5ca88b3..6fe00e0 100644 --- a/docz/docs/03-demos/42-engines/07_nashorn.md +++ b/docz/docs/03-demos/42-engines/07_nashorn.md @@ -13,8 +13,8 @@ Nashorn is a JavaScript engine for Java. It shipped with Java distributions starting with Java 8 and was eventually removed in Java 15. The project was spun off and a compatible standalone release is available for Java 15+. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a Nashorn context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a Nashorn context. ## Integration Details @@ -128,7 +128,8 @@ curl -LO "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-util/9 -1) Download the standalone script, shim script, and the test file: +1) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
              • xlsx.full.min.js
              • diff --git a/docz/docs/03-demos/42-engines/08_quickjs.md b/docz/docs/03-demos/42-engines/08_quickjs.md index b3be1c6..bfa6068 100644 --- a/docz/docs/03-demos/42-engines/08_quickjs.md +++ b/docz/docs/03-demos/42-engines/08_quickjs.md @@ -303,7 +303,8 @@ gcc -o sheetjs.quick -Wall sheetjs.quick.c libquickjs.a -lm This program tries to parse the file specified by the first argument -4) Download the standalone script and test file: +4) Download the SheetJS Standalone script and test file. Save both files in +the project directory:
                • xlsx.full.min.js
                • @@ -335,7 +336,8 @@ This demo was last tested on 2023 August 26 against QuickJS commit `2788d71`. 0) Ensure `quickjs` command line utility is installed -1) Download the standalone script and the test file: +1) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
                  • xlsx.full.min.js
                  • diff --git a/docz/docs/03-demos/42-engines/09_hermes.md b/docz/docs/03-demos/42-engines/09_hermes.md index ad0fcaa..d6ef595 100644 --- a/docz/docs/03-demos/42-engines/09_hermes.md +++ b/docz/docs/03-demos/42-engines/09_hermes.md @@ -402,7 +402,8 @@ make init make sheetjs-hermes ``` -6) Download the standalone script and test file: +6) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
                    • xlsx.full.min.js
                    • @@ -436,7 +437,8 @@ as a Base64 string and directly add it to an amalgamated script. 0) Install the `hermes` command line tool -1) Download the standalone script and test file: +1) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
                      • xlsx.full.min.js
                      • diff --git a/docz/docs/03-demos/42-engines/14-pandas.md b/docz/docs/03-demos/42-engines/14-pandas.md index 3b98742..d3e29bd 100644 --- a/docz/docs/03-demos/42-engines/14-pandas.md +++ b/docz/docs/03-demos/42-engines/14-pandas.md @@ -84,9 +84,9 @@ def convert(obj): _Loading the Library_ -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated from the JS engine. Once evaluated, the `XLSX` variable is -available as a global. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated from the JS engine. Once evaluated, the `XLSX` +variable is available as a global. Assuming the standalone library is in the same directory as the source file, the script can be evaluated with `eval`: @@ -363,8 +363,11 @@ cd .. ### Demo -1) Follow the [standalone script](/docs/getting-started/installation/standalone) - instructions to download the script: +1) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} @@ -410,10 +413,10 @@ If Pandas is installed, the script will display DataFrame metadata: ``` RangeIndex: 5 entries, 0 to 4 Data columns (total 2 columns): - # Column Non-Null Count Dtype ---- ------ -------------- ----- + # Column Non-Null Count Dtype +--- ------ -------------- ----- 0 Name 5 non-null object - 1 Index 5 non-null int64 + 1 Index 5 non-null int64 dtypes: int64(1), object(1) ``` diff --git a/docz/docs/03-demos/42-engines/15_rb.md b/docz/docs/03-demos/42-engines/15_rb.md index 82d838f..665f549 100644 --- a/docz/docs/03-demos/42-engines/15_rb.md +++ b/docz/docs/03-demos/42-engines/15_rb.md @@ -9,8 +9,8 @@ import CodeBlock from '@theme/CodeBlock'; ExecJS is a Ruby abstraction over a number of JS runtimes including V8. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in every supported runtime. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in every supported runtime. ## Integration Details @@ -91,7 +91,8 @@ sudo gem install execjs ::: -1) Download the standalone script and test file: +1) Download the SheetJS Standalone script and the test file. Save both files in +the project directory:
                        • xlsx.full.min.js
                        • diff --git a/docz/docs/03-demos/42-engines/20_chakra.md b/docz/docs/03-demos/42-engines/20_chakra.md index df84bb7..d71fbba 100644 --- a/docz/docs/03-demos/42-engines/20_chakra.md +++ b/docz/docs/03-demos/42-engines/20_chakra.md @@ -11,8 +11,8 @@ import CodeBlock from '@theme/CodeBlock'; ChakraCore is an embeddable JS engine written in C++. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a ChakraCore context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a ChakraCore context. ## Integration Details @@ -326,7 +326,8 @@ cl sheetjs.ch.cpp ChakraCore.lib /I ChakraCore\lib\Jsrt /link /LIBPATH:ChakraCor -5) Download the standalone script, shim script, and test file: +5) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
                          • xlsx.full.min.js
                          • @@ -383,7 +384,8 @@ It will typically be placed in the `ChakraCore/out/Test/` folder. ::: -1) Download the standalone script, shim, and test file: +1) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the project directory:
                            • xlsx.full.min.js
                            • diff --git a/docz/docs/03-demos/42-engines/21_boa.md b/docz/docs/03-demos/42-engines/21_boa.md index 9d829d7..95f728e 100644 --- a/docz/docs/03-demos/42-engines/21_boa.md +++ b/docz/docs/03-demos/42-engines/21_boa.md @@ -16,8 +16,8 @@ more performant engine like [`v8`](/docs/demos/engines/v8#rust) Boa is a pure-Rust JavaScript engine. -The [Standalone scripts](/docs/getting-started/installation/standalone) can be -parsed and evaluated in a Boa context. +The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone) +can be parsed and evaluated in a Boa context. ## Integration Details @@ -136,7 +136,11 @@ cargo run cargo add boa_engine ``` -3) Download the [Standalone build](/docs/getting-started/installation/standalone): +3) Download the SheetJS Standalone script and move to the project directory: + + {`\ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`} diff --git a/docz/docs/03-demos/42-engines/index.md b/docz/docs/03-demos/42-engines/index.md index efeb376..f48032b 100644 --- a/docz/docs/03-demos/42-engines/index.md +++ b/docz/docs/03-demos/42-engines/index.md @@ -7,6 +7,7 @@ pagination_next: solutions/input import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; Browser vendors and other organizations have built "JavaScript engines". They are independent software libraries that are capable of running JS scripts. @@ -156,7 +157,8 @@ cd jerryscript python tools/build.py --error-messages=ON --logging=ON --mem-heap=8192 --cpointer-32bit=ON ``` -1) Download the standalone script, shim, and test file: +1) Download the SheetJS Standalone script, shim script and test file. Move all +three files to the `jerryscript` cloned repo directory:
                              • xlsx.full.min.js
                              • @@ -164,6 +166,12 @@ python tools/build.py --error-messages=ON --logging=ON --mem-heap=8192 --cpointe
                              • pres.xlsx
                              +{`\ +curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js +curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js +curl -LO https://sheetjs.com/pres.xlsx`} + + 2) Bundle the test file and create `payload.js`: ```bash diff --git a/docz/docs/07-csf/02-cell.md b/docz/docs/07-csf/02-cell.md index 8289d06..18ba880 100644 --- a/docz/docs/07-csf/02-cell.md +++ b/docz/docs/07-csf/02-cell.md @@ -200,13 +200,17 @@ Each primitive value in JavaScript has a type which can be displayed with the | String | `"SheetJS"` | `"string"` | | Number | `5433795` | `"number"` | -#### Null and Undefined +#### Undefined `undefined` in JavaScript is spiritually equivalent to a blank cell value in Excel. By default, SheetJS methods that generate worksheets skip `undefined`. +#### Null + `null` in JavaScript typically is used to represent no data. The `#NULL!` error in Excel is intended to break formula expressions that reference the cells[^3]. +`#NULL!` is spiritually similar to `NaN`. + By default, SheetJS methods that generate worksheets skip `null`. Some methods include options to generate `#NULL!` error cells. @@ -229,7 +233,7 @@ valid strings for the requested file formats. The underlying value of a JavaScript number is always the original number. SheetJS export methods will translate supported numbers to numeric cells. `NaN` -values will be translated to Excel `#NUM!` errors. Infinities and subnormal +values will be translated to Excel `#NUM!` errors. Infinities and denormalized values are translated to `#DIV/0!`. #### Dates