forked from sheetjs/docs.sheetjs.com
cell
This commit is contained in:
parent
871acac297
commit
7f366322e7
@ -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:
|
||||
|
@ -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`:
|
||||
|
@ -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
|
||||
|
||||
</details>
|
||||
|
||||
:::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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
|
||||
@ -824,7 +827,7 @@ writeFileXLSX(workbook, "Presidents.xlsx");
|
||||
</html>
|
||||
```
|
||||
|
||||
:::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
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::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 ... */ };
|
||||
</TabItem>
|
||||
<TabItem value="nodejs" label="NodeJS">
|
||||
|
||||
:::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 = {
|
||||
<Tabs>
|
||||
<TabItem value="23" label="2.x and 3.x">
|
||||
|
||||
:::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.
|
||||
|
||||
</details>
|
||||
|
||||
:::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.
|
||||
|
@ -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 `<script>` tags.
|
||||
The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone)
|
||||
can be referenced in a `SCRIPT` tag from an HTML page. For legacy deployments,
|
||||
the shim script must be loaded first:
|
||||
|
||||
<CodeBlock language="html">{`\
|
||||
<!-- SheetJS version ${current} \`shim.min.js\` -->
|
||||
<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js"></script>
|
||||
<!-- SheetJS version ${current} \`xlsx.full.min.js\` -->
|
||||
<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js"></script>
|
||||
<script>
|
||||
/* display SheetJS version */
|
||||
if(typeof console == "object" && console.log) console.log(XLSX.version);
|
||||
else if(typeof alert != "undefined") alert(XLSX.version);
|
||||
else document.write(XLSX.version);
|
||||
</script>`}
|
||||
</CodeBlock>
|
||||
|
||||
## 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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js`}>shim.min.js</a></li>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
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.
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
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"
|
||||
<!DOCTYPE html>
|
||||
@ -265,9 +268,9 @@ line must be added to the first block.
|
||||
</html>
|
||||
```
|
||||
|
||||
- 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
|
||||
|
||||
<p>The app should print <code>SheetJS Version {current}</code></p>
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
|
||||
|
@ -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:
|
||||
|
||||
<CodeBlock language="html">{`\
|
||||
<script src="https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js"></script>
|
||||
|
@ -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`
|
||||
|
||||
<p>1) Download <a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.full.min.js</a></p>
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
<li><a href="https://sheetjs.com/pres.numbers">pres.numbers</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://sheetjs.com/pres.numbers
|
||||
|
@ -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)
|
||||
|
||||
<CodeBlock language="js">{`\
|
||||
importScripts("https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js");`}
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js`}>shim.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -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
|
||||
|
@ -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
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
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)
|
||||
```
|
||||
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
|
||||
|
@ -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:
|
||||
|
||||
<ul>
|
||||
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
|
||||
@ -164,6 +166,12 @@ python tools/build.py --error-messages=ON --logging=ON --mem-heap=8192 --cpointe
|
||||
<li><a href="https://sheetjs.com/pres.xlsx">pres.xlsx</a></li>
|
||||
</ul>
|
||||
|
||||
<CodeBlock language="bash">{`\
|
||||
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`}
|
||||
</CodeBlock>
|
||||
|
||||
2) Bundle the test file and create `payload.js`:
|
||||
|
||||
```bash
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user