content
@ -39,6 +39,9 @@ Once installed, the library can be imported under the name `xlsx`:
 | 
			
		||||
import { read, writeFileXLSX } from "xlsx";
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The ["Bundlers" demo](../../demos/bundler) includes examples for specific
 | 
			
		||||
bundler tools.
 | 
			
		||||
 | 
			
		||||
:::warning
 | 
			
		||||
 | 
			
		||||
Older releases are technically available on the public npm registry as `xlsx`,
 | 
			
		||||
							
								
								
									
										0
									
								
								docz/docs/02-installation/04-nodejs.md → docz/docs/02-getting-started/01-installation/04-nodejs.md
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						@ -34,7 +34,7 @@ define(['N/file', './xlsx.full.min'], function(file, XLSX) {
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
As explained in the [NetSuite demo](../getting-started/demos/netsuite), module
 | 
			
		||||
As explained in the [NetSuite demo](../../demos/netsuite), module
 | 
			
		||||
aliases are created in config files referenced via `@NAmdConfig` comments.
 | 
			
		||||
 | 
			
		||||
## SAP UI5
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "Installation",
 | 
			
		||||
  "position": 2
 | 
			
		||||
  "position": 1
 | 
			
		||||
}
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 3
 | 
			
		||||
sidebar_position: 2
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Complete Example
 | 
			
		||||
# Tutorial
 | 
			
		||||
 | 
			
		||||
SheetJS presents a simple JS interface that works with "Array of Arrays" and
 | 
			
		||||
"Array of JS Objects".  The API functions are building blocks that should be
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 1
 | 
			
		||||
sidebar_position: 3
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Roadmap
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 2
 | 
			
		||||
sidebar_position: 4
 | 
			
		||||
hide_table_of_contents: true
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ representation of the core concepts of a workbook.  The various functions in the
 | 
			
		||||
library provide low-level tools for working with the object.
 | 
			
		||||
 | 
			
		||||
For friendly JS processing, there are utility functions for converting parts of
 | 
			
		||||
a worksheet to/from an Array of Arrays.  The [Complete example](../03-example.mdx)
 | 
			
		||||
a worksheet to/from an Array of Arrays.  The [Complete example](./02-example.mdx)
 | 
			
		||||
combines powerful JS Array methods with a network request library to download
 | 
			
		||||
data, select the information we want and create a workbook file:
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "Getting Started",
 | 
			
		||||
  "collapsed": false,
 | 
			
		||||
  "position": 4
 | 
			
		||||
  "position": 2
 | 
			
		||||
}
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
							
								
								
									
										29
									
								
								docz/docs/02-getting-started/index.md
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						@ -0,0 +1,29 @@
 | 
			
		||||
---
 | 
			
		||||
hide_table_of_contents: true
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Getting Started
 | 
			
		||||
 | 
			
		||||
["Tutorial"](./02-example.mdx) is a live example that covers general data
 | 
			
		||||
munging and data export to spreadsheets.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
import DocCardList from '@theme/DocCardList';
 | 
			
		||||
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
 | 
			
		||||
 | 
			
		||||
<https://cdn.sheetjs.com> is the primary software distribution site.  Please
 | 
			
		||||
read the installation instructions for your use case:
 | 
			
		||||
 | 
			
		||||
<ul>{useCurrentSidebarCategory().items.map((item, index) => {
 | 
			
		||||
  if(item.label != "Installation") return "";
 | 
			
		||||
  return item.items.map((item, index) => {
 | 
			
		||||
    const listyle = (item.customProps?.icon) ? {
 | 
			
		||||
      listStyleImage: `url("${item.customProps.icon}")`
 | 
			
		||||
    } : {};
 | 
			
		||||
    return (<li style={listyle} {...(item.customProps?.class ? {className: item.customProps.class}: {})}>
 | 
			
		||||
      <a href={item.href}>{item.label}</a>{item.customProps?.summary && (" - " + item.customProps.summary)}
 | 
			
		||||
    </li>);
 | 
			
		||||
  });
 | 
			
		||||
})}</ul>
 | 
			
		||||
 | 
			
		||||
@ -1,20 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
hide_table_of_contents: true
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Installation
 | 
			
		||||
 | 
			
		||||
import DocCardList from '@theme/DocCardList';
 | 
			
		||||
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
 | 
			
		||||
 | 
			
		||||
<https://cdn.sheetjs.com> is the primary software distribution site.  Please
 | 
			
		||||
read the installation instructions for your use case:
 | 
			
		||||
 | 
			
		||||
<ul>{useCurrentSidebarCategory().items.map((item, index) => {
 | 
			
		||||
  const listyle = (item.customProps?.icon) ? {
 | 
			
		||||
    listStyleImage: `url("${item.customProps.icon}")`
 | 
			
		||||
  } : {};
 | 
			
		||||
  return (<li style={listyle} {...(item.customProps?.class ? {className: item.customProps.class}: {})}>
 | 
			
		||||
    <a href={item.href}>{item.label}</a>{item.customProps?.summary && (" - " + item.customProps.summary)}
 | 
			
		||||
  </li>);
 | 
			
		||||
})}</ul>
 | 
			
		||||
@ -107,7 +107,7 @@ should see a page like
 | 
			
		||||
 | 
			
		||||
## Adding the Standalone Script
 | 
			
		||||
 | 
			
		||||
The [standalone script](../../installation/standalone) can be downloaded and
 | 
			
		||||
The [standalone script](../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.
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ extension development is assumed.
 | 
			
		||||
 | 
			
		||||
## ExtendScript Scripts
 | 
			
		||||
 | 
			
		||||
[Installation is straightforward:](../../installation/extendscript) download a
 | 
			
		||||
[Installation is straightforward:](../getting-started/installation/extendscript) download a
 | 
			
		||||
script and move it to your project directory.
 | 
			
		||||
 | 
			
		||||
### Reading Files
 | 
			
		||||
@ -179,12 +179,12 @@ and place in the scripts directory.  For CS6 Windows 10 the path is typically
 | 
			
		||||
 | 
			
		||||
## CEP
 | 
			
		||||
 | 
			
		||||
[The standalone scripts](../../installation/standalone) can be added to CEP
 | 
			
		||||
[The standalone scripts](../getting-started/installation/standalone) can be added to CEP
 | 
			
		||||
extension HTML
 | 
			
		||||
 | 
			
		||||
## UXP
 | 
			
		||||
 | 
			
		||||
UXP officially recommends `require` and NodeJS Modules for third party support.
 | 
			
		||||
 | 
			
		||||
[Use the "Frameworks" instructions to download.](../../installation/frameworks)
 | 
			
		||||
[Use the "Frameworks" instructions to download.](../getting-started/installation/frameworks)
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,14 @@ sidebar_position: 6
 | 
			
		||||
title: HTTP Network Requests
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# XHR and fetch
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
 | 
			
		||||
  <script src="https://unpkg.com/superagent@7.1.1/dist/superagent.min.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
`XMLHttpRequest` and `fetch` browser APIs enable binary data transfer between
 | 
			
		||||
web browser clients and web servers.  Since this library works in web browsers,
 | 
			
		||||
server conversion work can be offloaded to the client!  This demo shows a few
 | 
			
		||||
@ -384,7 +387,7 @@ function SheetJSAxiosUL() {
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
### superagent Wrapper Library
 | 
			
		||||
#### superagent
 | 
			
		||||
 | 
			
		||||
The `superagent` library usage mirrors XHR:
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,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](../../installation/standalone) can be added to
 | 
			
		||||
The [SheetJS standalone script](../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.
 | 
			
		||||
@ -30,7 +30,7 @@ var XLSX = require("xlsx");
 | 
			
		||||
// ... use XLSX ...
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
[After installing the module](../../installation/nodejs), bundling is easy:
 | 
			
		||||
[After installing the module](../getting-started/installation/nodejs), bundling is easy:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
browserify app.js > browserify.js
 | 
			
		||||
@ -351,7 +351,7 @@ Parcel version 1.5.0 or later.
 | 
			
		||||
 | 
			
		||||
<details><summary><b>Complete Example</b> (click to show)</summary>
 | 
			
		||||
 | 
			
		||||
This demo follows the [Presidents Example](../../example).
 | 
			
		||||
This demo follows the [Presidents Example](../getting-started/example).
 | 
			
		||||
 | 
			
		||||
1) Save the following to `index.html`:
 | 
			
		||||
 | 
			
		||||
@ -433,7 +433,7 @@ click the "Click to Export!" button to generate a file.
 | 
			
		||||
 | 
			
		||||
## RequireJS
 | 
			
		||||
 | 
			
		||||
[Standalone scripts](../../installation/standalone) comply with AMD `define`
 | 
			
		||||
[Standalone scripts](../getting-started/installation/standalone) comply with AMD `define`
 | 
			
		||||
semantics, enabling use in RequireJS out of the box.
 | 
			
		||||
 | 
			
		||||
To enable use of the alias `xlsx`, the RequireJS config should set an alias in
 | 
			
		||||
@ -1067,7 +1067,7 @@ Webpack bundled the CommonJS build in older versions of the library.  Version
 | 
			
		||||
`0.18.1` changed the NodeJS module package so that Webpack uses the ESM build.
 | 
			
		||||
 | 
			
		||||
The ESM build does not include the codepage support library for XLS reading.
 | 
			
		||||
[As described in the installation instructions](../../installation/frameworks),
 | 
			
		||||
[As described in the installation instructions](../getting-started/installation/frameworks),
 | 
			
		||||
the codepage dependency should be imported explicitly:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
@ -120,7 +120,7 @@ This indicates that the SheetJS library has been loaded.
 | 
			
		||||
 | 
			
		||||
## Dynamic Arrays and SheetJS Array of Arrays
 | 
			
		||||
 | 
			
		||||
The [`sheet_to_json`](../../api/utilities#json) helper function can generate
 | 
			
		||||
The [`sheet_to_json`](../api/utilities#json) helper function can generate
 | 
			
		||||
arrays of arrays of values based on the worksheet data.  Excel custom functions
 | 
			
		||||
transparently treat these as Dynamic Arrays.
 | 
			
		||||
 | 
			
		||||
@ -160,7 +160,7 @@ var wb = XLSX.read(ab); // parse workbook
 | 
			
		||||
 | 
			
		||||
For the purposes of this demo, a Base64-encoded file will be used.  The
 | 
			
		||||
workaround involves fetching that Base64 file, getting the text, and parsing
 | 
			
		||||
with the [`base64` type:](../../api/parse-options#input-type)
 | 
			
		||||
with the [`base64` type:](../api/parse-options#input-type)
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
async function extern() {
 | 
			
		||||
@ -14,7 +14,7 @@ SheetJS libraries strive to maintain broad browser and JS engine compatibility.
 | 
			
		||||
 | 
			
		||||
## Integration
 | 
			
		||||
 | 
			
		||||
The ["Standalone Browser Scripts"](../../installation/standalone) section has
 | 
			
		||||
The ["Standalone Browser Scripts"](../getting-started/installation/standalone) section has
 | 
			
		||||
instructions for obtaining or referencing the standalone scripts.  These are
 | 
			
		||||
designed to be referenced with `<script>` tags.
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 15
 | 
			
		||||
title: Chrome and Chromium
 | 
			
		||||
title: Chrome Extensions
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
:::warning
 | 
			
		||||
@ -9,7 +9,7 @@ windowing framework. SheetJS is compatible with many toolkits.
 | 
			
		||||
 | 
			
		||||
## NW.js
 | 
			
		||||
 | 
			
		||||
The [Standalone scripts](../../installation/standalone) can be referenced in a
 | 
			
		||||
The [Standalone scripts](../getting-started/installation/standalone) can be referenced in a
 | 
			
		||||
`SCRIPT` tag from the entry point HTML page.
 | 
			
		||||
 | 
			
		||||
This demo was tested against NW.js 0.66.0.
 | 
			
		||||
@ -66,7 +66,7 @@ This will generate the standalone app in the `build\sheetjs-nwjs\` folder.
 | 
			
		||||
The standard HTML5 `FileReader` techniques from the browser apply to NW.js!
 | 
			
		||||
 | 
			
		||||
NW.js handles the OS minutiae for dragging files into app windows.  The
 | 
			
		||||
[drag and drop snippet](../../solutions/input#example-user-submissions) apply
 | 
			
		||||
[drag and drop snippet](../solutions/input#example-user-submissions) apply
 | 
			
		||||
to DIV elements on the page.
 | 
			
		||||
 | 
			
		||||
Similarly, file input elements automatically map to standard Web APIs.
 | 
			
		||||
@ -129,7 +129,7 @@ input.click();
 | 
			
		||||
 | 
			
		||||
## Electron
 | 
			
		||||
 | 
			
		||||
The [NodeJS Module](../../installation/nodejs) can be imported from the main or
 | 
			
		||||
The [NodeJS Module](../getting-started/installation/nodejs) can be imported from the main or
 | 
			
		||||
the renderer thread.
 | 
			
		||||
 | 
			
		||||
Electron presents a `fs` module.  The `require('xlsx')` call loads the CommonJS
 | 
			
		||||
@ -186,7 +186,7 @@ For a recent Intel Mac, the path will be `out/sheetjs-electron-darwin-x64/`
 | 
			
		||||
 | 
			
		||||
### Writing Files
 | 
			
		||||
 | 
			
		||||
[`XLSX.writeFile`](../../api/write-options) writes workbooks to the filesystem.
 | 
			
		||||
[`XLSX.writeFile`](../api/write-options) writes workbooks to the filesystem.
 | 
			
		||||
`showSaveDialog` shows a Save As dialog and returns the selected file name:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
@ -254,7 +254,7 @@ document.getElementById("xlf").addEventListener("change", handleFile, false);
 | 
			
		||||
 | 
			
		||||
**Drag and Drop**
 | 
			
		||||
 | 
			
		||||
The [drag and drop snippet](../../solutions/input#example-user-submissions)
 | 
			
		||||
The [drag and drop snippet](../solutions/input#example-user-submissions)
 | 
			
		||||
applies to DIV elements on the page.
 | 
			
		||||
 | 
			
		||||
For example, assuming a DIV on the page:
 | 
			
		||||
@ -282,7 +282,7 @@ document.getElementById("drop").addEventListener("drop", handleDrop, false);
 | 
			
		||||
 | 
			
		||||
**Electron API**
 | 
			
		||||
 | 
			
		||||
[`XLSX.readFile`](../../api/parse-options) reads workbooks from the filesystem.
 | 
			
		||||
[`XLSX.readFile`](../api/parse-options) reads workbooks from the filesystem.
 | 
			
		||||
`showOpenDialog` shows a Save As dialog and returns the selected file name.
 | 
			
		||||
Unlike the Web APIs, the `showOpenDialog` flow can be initiated by app code:
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,7 @@ provide, usually there are third-party modules to provide needed functionality.
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
 | 
			
		||||
This demo was tested on an Intel Mac on August 10 2022.  NativeScript version
 | 
			
		||||
This demo was tested on an Intel Mac on 2022 August 10.  NativeScript version
 | 
			
		||||
(as verified with `ns --version`) is `8.3.2`.  The iOS simulator runs iOS 15.5
 | 
			
		||||
on an iPhone SE 3rd generation.
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,7 @@ await file.writeText(bstr, encoding.ISO_8859_1);
 | 
			
		||||
The demo builds off of the NativeScript + Angular example.  Familiarity with
 | 
			
		||||
with Angular and TypeScript is assumed.
 | 
			
		||||
 | 
			
		||||
<details open><summary><b>Complete Example</b> (click to show)</summary>
 | 
			
		||||
<details><summary><b>Complete Example</b> (click to show)</summary>
 | 
			
		||||
 | 
			
		||||
0) Follow the official Environment Setup instructions (tested with "macOS + iOS")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										217
									
								
								docz/docs/03-demos/20-content.md
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						@ -0,0 +1,217 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 20
 | 
			
		||||
title: Content and Site Generation
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
With the advent of server-side frameworks and content management systems, it is
 | 
			
		||||
possible to build sites whose source of truth is a spreadsheet!  This demo
 | 
			
		||||
explores a number of approaches.
 | 
			
		||||
 | 
			
		||||
## GatsbyJS
 | 
			
		||||
 | 
			
		||||
[`gatsby-transformer-excel`](https://www.gatsbyjs.com/plugins/gatsby-transformer-excel/)
 | 
			
		||||
generates nodes for each data row of each worksheet. The official documentation
 | 
			
		||||
includes examples and more detailed usage instructions.
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
 | 
			
		||||
`gatsby-transformer-excel` is maintained by the Gatsby core team and all bugs
 | 
			
		||||
should be directed to the main Gatsby project.  If it is determined to be a bug
 | 
			
		||||
in the parsing logic, issues should then be raised with the SheetJS project.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
## NuxtJS
 | 
			
		||||
 | 
			
		||||
`@nuxt/content` is a file-based CMS for Nuxt, enabling static-site generation
 | 
			
		||||
and on-demand server rendering powered by spreadsheets.
 | 
			
		||||
 | 
			
		||||
#### nuxt.config.js configuration
 | 
			
		||||
 | 
			
		||||
Through an override in `nuxt.config.js`, Nuxt Content will use custom parsers.
 | 
			
		||||
Differences from a stock `create-nuxt-app` config are shown below:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
// highlight-start
 | 
			
		||||
import { readFile, utils } from 'xlsx';
 | 
			
		||||
 | 
			
		||||
// This will be called when the files change
 | 
			
		||||
const parseSheet = (file, { path }) => {
 | 
			
		||||
  // `path` is a path that can be read with `XLSX.readFile`
 | 
			
		||||
  const wb = readFile(path);
 | 
			
		||||
  const o = wb.SheetNames.map(name => ({ name, data: utils.sheet_to_json(wb.Sheets[name])}));
 | 
			
		||||
  return { data: o };
 | 
			
		||||
}
 | 
			
		||||
// highlight-end
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
// ...
 | 
			
		||||
 | 
			
		||||
// highlight-start
 | 
			
		||||
  // content.extendParser allows us to hook into the parsing step
 | 
			
		||||
  content: {
 | 
			
		||||
    extendParser: {
 | 
			
		||||
      // the keys are the extensions that will be matched.  The "." is required
 | 
			
		||||
      ".numbers": parseSheet,
 | 
			
		||||
      ".xlsx": parseSheet,
 | 
			
		||||
      ".xls": parseSheet,
 | 
			
		||||
      // can add other extensions like ".fods" as desired
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
// highlight-end
 | 
			
		||||
 | 
			
		||||
// ...
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Template Use
 | 
			
		||||
 | 
			
		||||
When a spreadsheet is placed in the `content` folder, Nuxt will find it.  The
 | 
			
		||||
data can be referenced in a view with `asyncData`.  The name should not include
 | 
			
		||||
the extension, so `"sheetjs.numbers"` would be referenced as `"sheetjs"`:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
  async asyncData ({$content}) {
 | 
			
		||||
    return {
 | 
			
		||||
      // $content('sheetjs') will match files with extensions in nuxt.config.js
 | 
			
		||||
      data: await $content('sheetjs').fetch()
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
In the template, `data.data` is an array of objects.  Each object has a `name`
 | 
			
		||||
property for the worksheet name and a `data` array of row objects.  This maps
 | 
			
		||||
neatly with nested `v-for`:
 | 
			
		||||
 | 
			
		||||
```xml
 | 
			
		||||
  <!-- loop over the worksheets -->
 | 
			
		||||
  <div v-for="item in data.data" v-bind:key="item.name">
 | 
			
		||||
    <table>
 | 
			
		||||
      <!-- loop over the rows of each worksheet -->
 | 
			
		||||
      <tr v-for="row in item.data" v-bind:key="row.Index">
 | 
			
		||||
        <!-- here `row` is a row object generated from sheet_to_json -->
 | 
			
		||||
        <td>{{ row.Name }}</td>
 | 
			
		||||
        <td>{{ row.Index }}</td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </table>
 | 
			
		||||
  </div>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Nuxt Content Demo
 | 
			
		||||
 | 
			
		||||
<details open><summary><b>Complete Example</b> (click to show)</summary>
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
 | 
			
		||||
This was tested against `create-nuxt-app v4.0.0` on 2022 August 13.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
1) Create a stock app:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npx create-nuxt-app SheetJSNuxt
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
When prompted, enter the following options:
 | 
			
		||||
 | 
			
		||||
- `Project name`: hit Enter (use default SheetJSNuxt)
 | 
			
		||||
- `Programming language`: hit Down Arrow (`TypeScript` selected) and hit Enter
 | 
			
		||||
- `Package manager`: select `Npm` and hit Enter
 | 
			
		||||
- `UI framework`: select `None` and hit Enter
 | 
			
		||||
- `Nuxt.js modules`: scroll to `Content`, select with Space, then hit Enter
 | 
			
		||||
- `Linting tools`: hit Enter (do not select any Linting tools)
 | 
			
		||||
- `Testing framework`: select `None` and hit Enter
 | 
			
		||||
- `Rendering mode`: select `Universal (SSR / SSG)` and hit Enter
 | 
			
		||||
- `Deployment target`: select `Static (Static/Jamstack hosting)` and hit Enter
 | 
			
		||||
- `Development tools`: hit Enter (do not select any Development tools)
 | 
			
		||||
- `What is your GitHub username?`: hit Enter
 | 
			
		||||
- `Version control system`: select `None`
 | 
			
		||||
 | 
			
		||||
The project will be configured and modules will be installed.
 | 
			
		||||
 | 
			
		||||
2) Install the SheetJS library and start the dev server:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cd SheetJSNuxt
 | 
			
		||||
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz
 | 
			
		||||
npm run dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
When the build finishes, the terminal will display a URL like:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
ℹ Listening on: http://localhost:64688/                                                            05:41:11
 | 
			
		||||
No issues found.                                                                                   05:41:11
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The dev server is listening on that URL.  Open the link in a web browser.
 | 
			
		||||
 | 
			
		||||
3) Download <https://sheetjs.com/pres.xlsx> and move to the `content` folder.
 | 
			
		||||
 | 
			
		||||
4) Modify `nuxt.config.js` as described [earlier](#nuxtconfigjs-configuration)
 | 
			
		||||
 | 
			
		||||
5) Replace `pages/index.vue` with the following:
 | 
			
		||||
 | 
			
		||||
```html
 | 
			
		||||
<!-- sheetjs (C) 2013-present  SheetJS -- http://sheetjs.com -->
 | 
			
		||||
<template><div>
 | 
			
		||||
  <div v-for="item in data.data" v-bind:key="item.name">
 | 
			
		||||
    <h2>{{ item.name }}</h2>
 | 
			
		||||
    <table><thead><tr><th>Name</th><th>Index</th></tr></thead><tbody>
 | 
			
		||||
      <tr v-for="row in item.data" v-bind:key="row.Index">
 | 
			
		||||
        <td>{{ row.Name }}</td>
 | 
			
		||||
        <td>{{ row.Index }}</td>
 | 
			
		||||
      </tr>
 | 
			
		||||
    </tbody></table>
 | 
			
		||||
  </div>
 | 
			
		||||
</div></template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  async asyncData ({$content}) {
 | 
			
		||||
    return {
 | 
			
		||||
      data: await $content('pres').fetch()
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The browser should refresh to show the contents of the spreadsheet.  If it does
 | 
			
		||||
not, hit Refresh manually or open a new browser window.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
6) To verify that hot loading works, open `pres.xlsx` from the `content` folder
 | 
			
		||||
in Excel.  Add a new row to the bottom and save the file:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
The dev server terminal should show a line like:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
ℹ Updated ./content/pres.xlsx                                       @nuxt/content 05:43:37
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The page should automatically refresh with the new content:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
7) Stop the dev server (hit `CTRL+C` in the terminal window) and run
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npm run generate
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This will create a static site in the `dist` folder, which can be served with:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npx http-server dist
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Accessing the page http://localhost:8080 will show the page contents. Verifying
 | 
			
		||||
the static nature is trivial: make another change in Excel and save.  The page
 | 
			
		||||
will not change.
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "Demos",
 | 
			
		||||
  "position": 3
 | 
			
		||||
  "position": 4
 | 
			
		||||
}
 | 
			
		||||
@ -37,6 +37,7 @@ The demo projects include small runnable examples and short explainers.
 | 
			
		||||
- [`Command-Line Tools`](./cli)
 | 
			
		||||
- [`iOS / Android Mobile Applications`](./mobile)
 | 
			
		||||
- [`NodeJS Server-Side Processing`](https://github.com/SheetJS/SheetJS/tree/master/demos/server/)
 | 
			
		||||
- [`Content Management and Static Sites`](./content)
 | 
			
		||||
- [`Electron`](./desktop#electron)
 | 
			
		||||
- [`NW.js`](./desktop#nwjs)
 | 
			
		||||
- [`Chrome / Chromium Extension`](./chromium)
 | 
			
		||||
@ -47,7 +47,7 @@ Deno scripts must be invoked with `--allow-read` to read from the filesystem.
 | 
			
		||||
 | 
			
		||||
Here are a few common scenarios (click on each subtitle to see the code).
 | 
			
		||||
 | 
			
		||||
The [demos](../getting-started/demos) cover special deployments in more detail.
 | 
			
		||||
The [demos](../demos) cover special deployments in more detail.
 | 
			
		||||
 | 
			
		||||
### Example: Local File
 | 
			
		||||
 | 
			
		||||
@ -90,7 +90,7 @@ var XLSX = require("xlsx");
 | 
			
		||||
var workbook = XLSX.readFile(path);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Electron APIs have changed over time.  The [`electron` demo](../getting-started/demos/desktop#electron)
 | 
			
		||||
Electron APIs have changed over time.  The [`electron` demo](../demos/desktop#electron)
 | 
			
		||||
shows a complete example and details the required version-specific settings.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
@ -195,7 +195,7 @@ var thisFile = File.openDialog("Select a spreadsheet");
 | 
			
		||||
var workbook = XLSX.readFile(thisFile.absoluteURI);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The [`extendscript` demo](../getting-started/demos/extendscript) includes a more complex example.
 | 
			
		||||
The [`extendscript` demo](../demos/extendscript) includes a more complex example.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="deno" label="Deno">
 | 
			
		||||
@ -498,7 +498,7 @@ req.onload = function(e) {
 | 
			
		||||
req.send();
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The [`xhr` demo](../getting-started/demos/network) includes a longer discussion and more examples.
 | 
			
		||||
The [`xhr` demo](../demos/network) includes a longer discussion and more examples.
 | 
			
		||||
 | 
			
		||||
<http://oss.sheetjs.com/sheetjs/ajax.html> shows fallback approaches for IE6+.
 | 
			
		||||
 | 
			
		||||
@ -551,7 +551,7 @@ const url = "http://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="bun" label="Bun">
 | 
			
		||||
 | 
			
		||||
Bun has native support for `fetch`.  Using the [NodeJS package](../installation/nodejs):
 | 
			
		||||
Bun has native support for `fetch`.  Using the [NodeJS package](../getting-started/installation/nodejs):
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
import * as XLSX from 'xlsx/xlsx.mjs';
 | 
			
		||||
@ -797,8 +797,8 @@ the optional `opts` argument in more detail.
 | 
			
		||||
 | 
			
		||||
#### Examples
 | 
			
		||||
 | 
			
		||||
["Complete Example"](../example) contains a detailed example "Get Data
 | 
			
		||||
from a JSON Endpoint and Generate a Workbook"
 | 
			
		||||
["Complete Example"](../getting-started/example) contains a detailed example
 | 
			
		||||
"Get Data from a JSON Endpoint and Generate a Workbook"
 | 
			
		||||
 | 
			
		||||
[`x-spreadsheet`](https://github.com/myliang/x-spreadsheet) is an interactive
 | 
			
		||||
data grid for previewing and modifying structured data in the web browser.  The
 | 
			
		||||
@ -806,7 +806,7 @@ data grid for previewing and modifying structured data in the web browser.  The
 | 
			
		||||
includes a sample script with the `xtos` function for converting from
 | 
			
		||||
x-spreadsheet to a workbook.  Live Demo: <https://oss.sheetjs.com/sheetjs/x-spreadsheet>
 | 
			
		||||
 | 
			
		||||
["Typed Arrays and ML"](../getting-started/demos/ml) covers strategies for
 | 
			
		||||
["Typed Arrays and ML"](../demos/ml) covers strategies for
 | 
			
		||||
creating worksheets from ML library exports (datasets stored in Typed Arrays).
 | 
			
		||||
 | 
			
		||||
<details>
 | 
			
		||||
@ -850,7 +850,7 @@ is missing or no options are specified, the default name `Sheet1` is used.
 | 
			
		||||
 | 
			
		||||
#### Examples
 | 
			
		||||
 | 
			
		||||
The [Headless Demo](../getting-started/demos/headless) includes examples of
 | 
			
		||||
The [Headless Demo](../demos/headless) includes examples of
 | 
			
		||||
server-side spreadsheet generation from HTML TABLE elements using headless
 | 
			
		||||
Chromium ("Puppeteer") and other browsers ("Playwright")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -64,7 +64,7 @@ files. The APIs do not generally provide feedback on whether files were created.
 | 
			
		||||
 | 
			
		||||
Here are a few common scenarios (click on each subtitle to see the code).
 | 
			
		||||
 | 
			
		||||
The [demos](../getting-started/demos) cover special deployments in more detail.
 | 
			
		||||
The [demos](../demos) cover special deployments in more detail.
 | 
			
		||||
 | 
			
		||||
### Example: Local File
 | 
			
		||||
 | 
			
		||||
@ -235,7 +235,7 @@ var XLSX = require("xlsx");
 | 
			
		||||
XLSX.writeFile(workbook, "out.xlsb");
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Electron APIs have changed over time.  The [`electron` demo](../getting-started/demos/desktop#electron)
 | 
			
		||||
Electron APIs have changed over time.  The [`electron` demo](../demos/desktop#electron)
 | 
			
		||||
shows a complete example and details the required version-specific settings.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
@ -313,12 +313,12 @@ var thisFile = File.saveDialog("Select an output file", "*.xlsx;*.xls");
 | 
			
		||||
XLSX.writeFile(workbook, thisFile.absoluteURI);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The [`extendscript` demo](../getting-started/demos/extendscript) includes a more complex example.
 | 
			
		||||
The [`extendscript` demo](../demos/extendscript) includes a more complex example.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="headless" label="Headless">
 | 
			
		||||
 | 
			
		||||
The [`headless` demo](../getting-started/demos/headless) includes complete
 | 
			
		||||
The [`headless` demo](../demos/headless) includes complete
 | 
			
		||||
examples of converting HTML TABLE elements to XLSB workbooks using Puppeteer
 | 
			
		||||
and other headless automation tools.
 | 
			
		||||
 | 
			
		||||
@ -503,7 +503,7 @@ is to adjust the server process or Lambda function to accept Base64 strings.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
A complete example using XHR is [included in the XHR demo](../getting-started/demos/network), along
 | 
			
		||||
A complete example using XHR is [included in the XHR demo](../demos/network), along
 | 
			
		||||
with examples for fetch and wrapper libraries.  This example assumes the server
 | 
			
		||||
can handle Base64-encoded files (see the demo for a basic nodejs server):
 | 
			
		||||
 | 
			
		||||
@ -658,7 +658,7 @@ simple VueJS 3 data table.  It is featured in the
 | 
			
		||||
 | 
			
		||||
### Example: Data Loading
 | 
			
		||||
 | 
			
		||||
["Typed Arrays and ML"](../getting-started/demos/ml) covers strategies for
 | 
			
		||||
["Typed Arrays and ML"](../demos/ml) covers strategies for
 | 
			
		||||
generating typed arrays and tensors from worksheet data.
 | 
			
		||||
 | 
			
		||||
<details>
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "Common Use Cases",
 | 
			
		||||
  "collapsed": false,
 | 
			
		||||
  "collapsed": true,
 | 
			
		||||
  "position": 6
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "CSF Object Model",
 | 
			
		||||
  "label": "SheetJS Data Model",
 | 
			
		||||
  "position": 7
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
  "label": "API Functions",
 | 
			
		||||
  "label": "API Reference",
 | 
			
		||||
  "position": 8
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,9 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 5
 | 
			
		||||
title: API Reference
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Interface Summary
 | 
			
		||||
## Interface Summary
 | 
			
		||||
 | 
			
		||||
`XLSX` is the exposed variable in the browser and the exported node variable
 | 
			
		||||
 | 
			
		||||
@ -18,7 +19,7 @@ sidebar_position: 5
 | 
			
		||||
 | 
			
		||||
`XLSX.readFile(filename, read_opts)` attempts to read `filename` and parse.
 | 
			
		||||
 | 
			
		||||
Parse options are described in the [Parsing Options](./api/parse-options) section.
 | 
			
		||||
Parse options are described in the [Parsing Options](./parse-options) section.
 | 
			
		||||
 | 
			
		||||
## Writing functions
 | 
			
		||||
 | 
			
		||||
@ -34,13 +35,13 @@ In browser-based environments, it will attempt to force a client-side download.
 | 
			
		||||
`XLSX.writeFileAsync(filename, wb, o, cb)` attempts to write `wb` to `filename`.
 | 
			
		||||
If `o` is omitted, the writer will use the third argument as the callback.
 | 
			
		||||
 | 
			
		||||
Write options are described in the [Writing Options](./api/write-options) section.
 | 
			
		||||
Write options are described in the [Writing Options](./write-options) section.
 | 
			
		||||
 | 
			
		||||
## Utilities
 | 
			
		||||
 | 
			
		||||
Utilities are available in the `XLSX.utils` object.
 | 
			
		||||
 | 
			
		||||
The following are described in [A1 Utilities](./csf/general#a1-utilities)
 | 
			
		||||
The following are described in [A1 Utilities](../csf/general#a1-utilities)
 | 
			
		||||
 | 
			
		||||
**Cell and cell address manipulation:**
 | 
			
		||||
 | 
			
		||||
@ -49,7 +50,7 @@ The following are described in [A1 Utilities](./csf/general#a1-utilities)
 | 
			
		||||
- `encode_cell / decode_cell` converts cell addresses.
 | 
			
		||||
- `encode_range / decode_range` converts cell ranges.
 | 
			
		||||
 | 
			
		||||
The following are described in the [Utility Functions](./api/utilities):
 | 
			
		||||
The following are described in the [Utility Functions](./utilities):
 | 
			
		||||
 | 
			
		||||
**Constructing:**
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
sidebar_position: 1
 | 
			
		||||
hide_table_of_contents: true
 | 
			
		||||
title: Overview
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# SheetJS CE
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,7 @@ const config = {
 | 
			
		||||
              },
 | 
			
		||||
              {
 | 
			
		||||
                label: 'Example',
 | 
			
		||||
                to: '/docs/example',
 | 
			
		||||
                to: '/docs/getting-started/example',
 | 
			
		||||
              },
 | 
			
		||||
            ],
 | 
			
		||||
          },
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ const FeatureList = [
 | 
			
		||||
      <div className={styles.buttons}>
 | 
			
		||||
        <Link
 | 
			
		||||
          className="button button--secondary button--lg"
 | 
			
		||||
          to="/docs/example">
 | 
			
		||||
          to="/docs/getting-started/example">
 | 
			
		||||
          Complete Example
 | 
			
		||||
        </Link>
 | 
			
		||||
      </div>
 | 
			
		||||
@ -55,7 +55,7 @@ const FeatureList = [
 | 
			
		||||
      <div className={styles.buttons}>
 | 
			
		||||
        <Link
 | 
			
		||||
          className="button button--secondary button--lg"
 | 
			
		||||
          to="/docs/getting-started/demos/">
 | 
			
		||||
          to="/docs/demos/">
 | 
			
		||||
          Demo Projects
 | 
			
		||||
        </Link>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
 | 
			
		||||
The core library can be used as-is in KnockoutJS applications.
 | 
			
		||||
The <a href="https://docs.sheetjs.com">Community Edition README</a> details some common use cases.
 | 
			
		||||
We also have some <a href="https://docs.sheetjs.com/docs/getting-started/demos/">more public demos</a>
 | 
			
		||||
We also have some <a href="https://docs.sheetjs.com/docs/demos/">more public demos</a>
 | 
			
		||||
 | 
			
		||||
This demo shows:
 | 
			
		||||
- view model backed by an array of arrays
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docz/static/nuxt/nuxl6.png
									
									
									
									
									
										Normal file
									
								
							
							
								
									
								
								
								
								
								
									
									
								
							
						
						| 
		 After Width: | Height: | Size: 35 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docz/static/nuxt/nuxt5.png
									
									
									
									
									
										Normal file
									
								
							
							
								
									
								
								
								
								
								
									
									
								
							
						
						| 
		 After Width: | Height: | Size: 27 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docz/static/nuxt/nuxt6.png
									
									
									
									
									
										Normal file
									
								
							
							
								
									
								
								
								
								
								
									
									
								
							
						
						| 
		 After Width: | Height: | Size: 33 KiB  |