forked from sheetjs/docs.sheetjs.com
spellcheck
This commit is contained in:
parent
4c92216ebe
commit
eb096bf09c
177
.spelling
177
.spelling
@ -1,4 +1,4 @@
|
||||
# xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com
|
||||
# SheetJS (C) 2013-present SheetJS -- http://sheetjs.com
|
||||
SheetJS
|
||||
sheetjs
|
||||
docs.sheetjs.com
|
||||
@ -10,18 +10,19 @@ DocCardList
|
||||
# Excel-related terms
|
||||
A1-Style
|
||||
AutoFilter
|
||||
BIFF12
|
||||
BIFF2
|
||||
BIFF3
|
||||
BIFF4
|
||||
BIFF5
|
||||
BIFF8
|
||||
BIFF12
|
||||
CFB
|
||||
CSV
|
||||
Chartsheet
|
||||
Chartsheets
|
||||
DBF
|
||||
DIF
|
||||
DSV
|
||||
Dialogsheet
|
||||
Dialogsheets
|
||||
ECMA-376
|
||||
@ -51,6 +52,7 @@ SYLK
|
||||
SpreadsheetML
|
||||
TSV
|
||||
TXT
|
||||
Tooltips
|
||||
UOS
|
||||
UOS1
|
||||
UOS2
|
||||
@ -76,10 +78,10 @@ WQ3
|
||||
XLML
|
||||
XLR
|
||||
XLS
|
||||
XLW
|
||||
XLSB
|
||||
XLSM
|
||||
XLSX
|
||||
XLW
|
||||
chartsheet
|
||||
chartsheets
|
||||
dBASE
|
||||
@ -103,85 +105,155 @@ tooltips
|
||||
9.x
|
||||
APIs
|
||||
ActiveX
|
||||
AngularJS
|
||||
ArrayBuffer
|
||||
Auth
|
||||
BOM
|
||||
Base64
|
||||
Base64-encoded
|
||||
Booleans
|
||||
Browserify
|
||||
Bundlers
|
||||
CDN
|
||||
CEP
|
||||
CLI
|
||||
CMS
|
||||
CORS
|
||||
CRX
|
||||
CS6
|
||||
CapacitorJS
|
||||
Chakra
|
||||
ChakraCore
|
||||
CommonJS
|
||||
Cordova
|
||||
DOM
|
||||
DPI
|
||||
DataGrid
|
||||
Deno
|
||||
Downloadify
|
||||
Drash
|
||||
Duktape
|
||||
ES3
|
||||
ES5
|
||||
ES6
|
||||
ESM
|
||||
ETH
|
||||
Ethercalc
|
||||
ExpressJS
|
||||
ExtendScript
|
||||
Fastify
|
||||
FileReader
|
||||
GatsbyJS
|
||||
Goja
|
||||
HTML
|
||||
HTML5
|
||||
HTTP
|
||||
HTTPS
|
||||
IE
|
||||
IE8
|
||||
IE10
|
||||
IE11
|
||||
IE6
|
||||
IE8
|
||||
IE9
|
||||
InDesign
|
||||
IndexedDB
|
||||
Integrations
|
||||
JDK
|
||||
JS
|
||||
JSX
|
||||
JavaScriptCore
|
||||
JerryScript
|
||||
Knex
|
||||
KnockoutJS
|
||||
LLC
|
||||
LWC
|
||||
Lifecycle
|
||||
LocalStorage
|
||||
LowDB
|
||||
Lume
|
||||
MVC
|
||||
MVVM
|
||||
MacOS
|
||||
MariaDB
|
||||
Meridiem
|
||||
MongoDB
|
||||
MySQL
|
||||
NPM
|
||||
NW.js
|
||||
Nashorn
|
||||
NativeScript
|
||||
NestJS
|
||||
NetSuite
|
||||
NextJS
|
||||
NoSQL
|
||||
NodeJS
|
||||
Northwind
|
||||
Nunjucks
|
||||
Nuxt
|
||||
NuxtJS
|
||||
PPI
|
||||
PhantomJS
|
||||
Photoshop
|
||||
PostgreSQL
|
||||
PowerShell
|
||||
Preact
|
||||
QuickJS
|
||||
R1
|
||||
R2
|
||||
R5
|
||||
R9
|
||||
RDBMS
|
||||
README
|
||||
RESTlets
|
||||
ReactJS
|
||||
Redis
|
||||
RequireJS
|
||||
Roadmap
|
||||
Rollup
|
||||
S3
|
||||
SDK
|
||||
SQLite
|
||||
SSL
|
||||
SWC
|
||||
SWF
|
||||
Schemas
|
||||
Serverless
|
||||
SessionStorage
|
||||
SlimerJS
|
||||
Snowpack
|
||||
SuiteScript
|
||||
SuiteScripts
|
||||
Suitelets
|
||||
SystemJS
|
||||
Tauri
|
||||
TensorFlow
|
||||
UI
|
||||
UI5
|
||||
URI
|
||||
UTF-16
|
||||
UTF-8
|
||||
UXP
|
||||
V2
|
||||
V8
|
||||
VBScript
|
||||
VSCodium
|
||||
Vendoring
|
||||
Vite
|
||||
ViteJS
|
||||
VueJS
|
||||
VueJS-friendly
|
||||
WMR
|
||||
WSL
|
||||
WebAssembly
|
||||
WebGL
|
||||
WebKit
|
||||
WebSQL
|
||||
Webpack
|
||||
XHR
|
||||
XMLHttpRequest
|
||||
XP
|
||||
Xcode
|
||||
angular-cli
|
||||
async
|
||||
axios
|
||||
bundler
|
||||
@ -196,8 +268,10 @@ dataset
|
||||
deduplication
|
||||
destructuring
|
||||
disambiguate
|
||||
disambiguated
|
||||
embeddable
|
||||
encodings
|
||||
esbuild
|
||||
filesystem
|
||||
globals
|
||||
iOS
|
||||
@ -205,9 +279,12 @@ iWork
|
||||
javascript
|
||||
lifecycle
|
||||
metadata
|
||||
microcontrollers
|
||||
middleware
|
||||
minified
|
||||
minifier
|
||||
namespace
|
||||
natively
|
||||
node.js
|
||||
nodejs
|
||||
npm
|
||||
parsers
|
||||
@ -216,78 +293,32 @@ pre-generated
|
||||
prepend
|
||||
prepended
|
||||
programmatically
|
||||
renderer
|
||||
repo
|
||||
runtime
|
||||
serverless
|
||||
subfolder
|
||||
submodule
|
||||
transpiled
|
||||
uncheck
|
||||
unpkg
|
||||
utils
|
||||
vendoring
|
||||
webpack
|
||||
weex
|
||||
|
||||
- demos/altjs/README.md
|
||||
ChakraCore
|
||||
Duktape
|
||||
Goja
|
||||
Nashorn
|
||||
QuickJS
|
||||
|
||||
- demos/angular/README.md
|
||||
AngularJS
|
||||
|
||||
- demos/angular2/README.md
|
||||
NativeScript
|
||||
angular-cli
|
||||
|
||||
- demos/array/README.md
|
||||
WebGL
|
||||
WebAssembly
|
||||
dataset
|
||||
TensorFlow
|
||||
|
||||
- demos/database/README.md
|
||||
Knex
|
||||
LowDB
|
||||
MariaDB
|
||||
MongoDB
|
||||
MySQL
|
||||
PostgreSQL
|
||||
schemaless
|
||||
schemas
|
||||
serverless
|
||||
sideloaded
|
||||
storages
|
||||
|
||||
- demos/extendscript/README.md
|
||||
Photoshop
|
||||
InDesign
|
||||
minifier
|
||||
|
||||
- demos/function/README.md
|
||||
microservice
|
||||
|
||||
- demos/headless/README.md
|
||||
PhantomJS
|
||||
SlimerJS
|
||||
subfolder
|
||||
submodule
|
||||
superagent
|
||||
transpile
|
||||
transpiled
|
||||
transpiling
|
||||
uncheck
|
||||
unidimensional
|
||||
unminified
|
||||
unpkg
|
||||
utils
|
||||
v4
|
||||
vendoring
|
||||
vscode-data-preview
|
||||
webpack
|
||||
weex
|
||||
wkhtmltopdf
|
||||
|
||||
- demos/nwjs/README.md
|
||||
NW.js
|
||||
|
||||
- demos/react/README.md
|
||||
Next.js
|
||||
Preact
|
||||
|
||||
- demos/server/README.md
|
||||
hapi
|
||||
|
||||
- demos/showcase/README.md
|
||||
vscode-data-preview
|
||||
|
||||
- demos/xhr/README.md
|
||||
axios
|
||||
superagent
|
||||
|
||||
|
||||
# frontmatter noise
|
||||
api
|
||||
csf
|
||||
|
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ serve:
|
||||
|
||||
.PHONY: spell
|
||||
spell:
|
||||
npx spellchecker-cli -d .spelling -f 'docz/**/*.md*' --no-suggestions
|
||||
npx spellchecker-cli -q -d .spelling -f 'docz/**/*.md*' --no-suggestions
|
||||
|
||||
.PHONY: index
|
||||
index: readme ## Rebuild site
|
||||
|
@ -28,8 +28,8 @@ The `latest` tag references the latest version and updates with each release:
|
||||
|
||||
:::warning
|
||||
|
||||
A number of CDNs host older versions of the SheetJS libraries. Due to syncing
|
||||
issues, they are generally out of date.
|
||||
A number of services host older versions of the SheetJS libraries. Due to
|
||||
syncing issues, they are generally out of date.
|
||||
|
||||
They are known CDN bugs.
|
||||
|
||||
@ -105,7 +105,7 @@ importScripts("https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.mi
|
||||
:::caution
|
||||
|
||||
This section refers to imports using `script type="module"`. For imports in
|
||||
modern projects using Webpack or React or Angular or Vue, the installation is
|
||||
modern projects using Webpack or React or Angular or VueJS, the installation is
|
||||
described [in the next section](./frameworks).
|
||||
|
||||
:::
|
||||
|
@ -111,7 +111,7 @@ The package will be installed and accessible as `xlsx`.
|
||||
#### CommonJS `require`
|
||||
|
||||
By default, the module supports `require` and it will automatically add support
|
||||
for streams and filesystem access:
|
||||
for streams and file system access:
|
||||
|
||||
```js
|
||||
var XLSX = require("xlsx");
|
||||
|
@ -25,8 +25,12 @@ This demo was built on a "Developer Edition" account. At the time of writing, an
|
||||
|
||||
### Create Sample Project and Component
|
||||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
Following the steps in ["Develop in Non-Scratch Orgs"](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.get_started_sfdx_deploy):
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
```bash
|
||||
## Login
|
||||
sfdx force:auth:web:login -d -a LWC-Hub
|
||||
@ -101,7 +105,7 @@ Click "Save" to activate the page, then click the left arrow to return to Setup.
|
||||
Click the App Launcher and select "Bolt Solutions" then "SheetJS Demo". You
|
||||
should see a page like
|
||||
|
||||
![SheetForce Demo](pathname:///files/sfinitial.png)
|
||||
![Demo](pathname:///files/sfinitial.png)
|
||||
|
||||
|
||||
## Adding the Standalone Script
|
||||
|
@ -17,7 +17,7 @@ support. Over the years there have been a few different JavaScript platforms:
|
||||
|
||||
- "UXP": This is the current Adobe recommendation for new CC extensions.
|
||||
|
||||
This demo intends to cover the SheetJS-related parts. General setup as well as
|
||||
This demo intends to cover parts relevant to SheetJS. General setup as well as
|
||||
general Adobe considerations are not covered here. A basic familiarity with
|
||||
extension development is assumed.
|
||||
|
||||
@ -122,8 +122,8 @@ XLSX.writeFile(workbook, thisFile.absoluteURI);
|
||||
<details open><summary><b>Complete Example</b> (click to hide)</summary>
|
||||
|
||||
In this example, the script will show a dialog to select an output file. Once
|
||||
selected, the library will create a new workbook with one worksheet. Cell A1
|
||||
will be "Author" and cell B1 will be the active Photoshop document Author.
|
||||
selected, the library will create a new workbook with one worksheet. Cell `A1`
|
||||
will be "Author" and cell `B1` will be the active Photoshop document Author.
|
||||
The PS author is available as `activeDocument.info.author`.
|
||||
|
||||
This demo was verified in Photoshop CS6 64-bit on Windows 10.
|
||||
|
@ -231,7 +231,7 @@ documents, and other simple data files. They enable workflows where the library
|
||||
generates CSV data for the database to process or where the library parses CSV
|
||||
files created by the database.
|
||||
|
||||
#### Worksheets to CSVs
|
||||
#### Worksheet to CSV
|
||||
|
||||
CSV data can be generated from worksheets using `XLSX.utils.sheet_to_csv`.
|
||||
|
||||
@ -243,7 +243,7 @@ const csv = XLSX.utils.sheet_to_json(ws);
|
||||
const csv_arr = wb.SheetNames.map(n => XLSX.utils.sheet_to_json(wb.Sheets[n]));
|
||||
```
|
||||
|
||||
#### CSVs to Worksheets
|
||||
#### CSV to Worksheet
|
||||
|
||||
`XLSX.read` can read strings with CSV data. It will generate single-sheet
|
||||
workbooks with worksheet name `Sheet1`.
|
||||
@ -432,11 +432,11 @@ db.readTransaction(tx =>
|
||||
);
|
||||
```
|
||||
|
||||
The following demo generates a database with hardcoded SQL statements. Queries
|
||||
The following demo generates a database with 5 fixed SQL statements. Queries
|
||||
can be changed in the Live Editor. The WebSQL database can be inspected in the
|
||||
"WebSQL" section of the "Application" Tab of Developer Tools:
|
||||
|
||||
![WebSQL DevTools](pathname:///files/websql.png)
|
||||
![WebSQL view in Developer Tools](pathname:///files/websql.png)
|
||||
|
||||
```jsx live
|
||||
function SheetQL() {
|
||||
@ -735,14 +735,6 @@ async function generate_sql(knex, ws, wsname) {
|
||||
|
||||
### MongoDB Structured Collections
|
||||
|
||||
:::warning MongoDB Relicense
|
||||
|
||||
This demo was originally written when MongoDB was licensed under AGPLv3. It was
|
||||
relicensed in 2018 to the Server-Side Public License. This demo was tested with
|
||||
the "MongoDB Community Server" and may not work with the "Enterprise" Server.
|
||||
|
||||
:::
|
||||
|
||||
MongoDB is a popular document-oriented database engine.
|
||||
|
||||
It is straightforward to treat collections as worksheets. Each object maps to
|
||||
@ -782,7 +774,7 @@ It was verified in Node 16.16.0.
|
||||
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz mongodb
|
||||
```
|
||||
|
||||
2) Start a MongoDB server on localhost (follow official instructions)
|
||||
2) Start a MongoDB server on `localhost` (follow official instructions)
|
||||
|
||||
3) Save the following to `SheetJSMongoCRUD.mjs` (the key step is highlighted):
|
||||
|
||||
|
@ -71,11 +71,11 @@ var workbook = XLSX.read(f.getContents(), {type: "base64"});
|
||||
`N/file` provides [`file.create`](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4223861820.html)
|
||||
and `file.load` for creating and loading files respectively.
|
||||
|
||||
Binary content must be base64-encoded. Fortunately, `XLSX.write` with `base64`
|
||||
Binary content must be Base64-encoded. Fortunately, `XLSX.write` with `base64`
|
||||
type will generate compatible Base64 strings:
|
||||
|
||||
```js
|
||||
/* write XLSX workbook as base64 string */
|
||||
/* write XLSX workbook as Base64 string */
|
||||
var out = XLSX.write(workbook, { bookType: "xlsx", type: "base64" });
|
||||
/* create file */
|
||||
var newfile = file.create({
|
||||
|
@ -131,7 +131,7 @@ This can be converted to a SheetJS worksheet using `XLSX.utils.aoa_to_sheet`:
|
||||
|
||||
### Generating an XLSB file
|
||||
|
||||
`XLSX.writeFile` will write a file in the filesystem:
|
||||
`XLSX.writeFile` will write a file in the file system:
|
||||
|
||||
```js
|
||||
/* write to SheetJS.xlsb */
|
||||
@ -235,7 +235,7 @@ includes detailed instructions for running locally.
|
||||
|
||||
### Reading the Workbook File
|
||||
|
||||
`XLSX.readFile` can read files from the filesystem. The following line reads
|
||||
`XLSX.readFile` can read files from the file system. The following line reads
|
||||
`sheetjs.xlsx` from the current directory:
|
||||
|
||||
```js
|
||||
|
@ -2,6 +2,9 @@
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Headless Automation
|
||||
|
||||
Headless automation involves controlling "headless browsers" to access websites
|
||||
@ -18,9 +21,9 @@ back to the automation script.
|
||||
This demo focuses on exporting table data to a workbook. Headless browsers do
|
||||
not generally support passing objects between the browser context and the
|
||||
automation script, so the file data must be generated in the browser context
|
||||
and sent back to the automation script for saving in the filesystem. Steps:
|
||||
and sent back to the automation script for saving in the file system. Steps:
|
||||
|
||||
1) Launch the headless browser and load the target webpage.
|
||||
1) Launch the headless browser and load the target site.
|
||||
|
||||
2) Add the standalone SheetJS build to the page in a `SCRIPT` tag.
|
||||
|
||||
@ -37,7 +40,7 @@ This demo exports data from <https://sheetjs.com/demos/table>.
|
||||
:::note
|
||||
|
||||
It is also possible to parse files from the browser context, but parsing from
|
||||
the automation context is more performant and strongly recommended.
|
||||
the automation context is more efficient and strongly recommended.
|
||||
|
||||
:::
|
||||
|
||||
@ -50,6 +53,9 @@ an installer script. Installation is straightforward:
|
||||
npm i https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz puppeteer
|
||||
```
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="nodejs" label="NodeJS">
|
||||
|
||||
Binary strings are the favored data type. They can be safely passed from the
|
||||
browser context to the automation script. NodeJS provides an API to write
|
||||
binary strings to file (`fs.writeFileSync` using encoding `binary`).
|
||||
@ -94,6 +100,71 @@ const puppeteer = require('puppeteer');
|
||||
})();
|
||||
```
|
||||
|
||||
This script will generate `SheetJSPuppeteer.xlsb` which can be opened in Excel.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="deno" label="Deno">
|
||||
|
||||
:::caution
|
||||
|
||||
Deno Puppeteer is a fork. It is not officially supported by the Puppeteer team.
|
||||
|
||||
:::
|
||||
|
||||
Installation is straightforward:
|
||||
|
||||
```bash
|
||||
env PUPPETEER_PRODUCT=chrome deno run -A --unstable https://deno.land/x/puppeteer@14.1.1/install.ts
|
||||
```
|
||||
|
||||
Base64 strings are the favored data type. They can be safely passed from the
|
||||
browser context to the automation script. Deno can decode the Base64 strings
|
||||
and write the decoded `Uint8Array` data to file with `Deno.writeFileSync`
|
||||
|
||||
To run the example, after installing the packages, save the following script to
|
||||
`SheetJSPuppeteer.ts` and run `deno run -A --unstable SheetJSPuppeteer.js`.
|
||||
|
||||
```js title="SheetJSPuppeteer.ts"
|
||||
import puppeteer from "https://deno.land/x/puppeteer@14.1.1/mod.ts";
|
||||
import { decode } from "https://deno.land/std/encoding/base64.ts"
|
||||
|
||||
/* (1) Load the target page */
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
page.on("console", msg => console.log("PAGE LOG:", msg.text()));
|
||||
await page.setViewport({width: 1920, height: 1080});
|
||||
await page.goto('https://sheetjs.com/demos/table');
|
||||
|
||||
/* (2) Load the standalone SheetJS build from the CDN */
|
||||
await page.addScriptTag({ url: 'https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js' });
|
||||
|
||||
/* (3) Run the snippet in browser and return data */
|
||||
const b64 = await page.evaluate(() => {
|
||||
/* NOTE: this function will be evaluated in the browser context.
|
||||
`page`, `fs` and `puppeteer` are not available.
|
||||
`XLSX` will be available thanks to step 2 */
|
||||
|
||||
/* find first table */
|
||||
var table = document.body.getElementsByTagName('table')[0];
|
||||
|
||||
/* call table_to_book on first table */
|
||||
var wb = XLSX.utils.table_to_book(table);
|
||||
|
||||
/* generate XLSB and return binary string */
|
||||
return XLSX.write(wb, {type: "base64", bookType: "xlsb"});
|
||||
});
|
||||
/* (4) write data to file */
|
||||
Deno.writeFileSync("SheetJSPuppeteer.xlsb", decode(b64));
|
||||
|
||||
await browser.close();
|
||||
```
|
||||
|
||||
This script will generate `SheetJSPuppeteer.xlsb` which can be opened in Excel.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
## Playwright
|
||||
|
||||
Playwright presents a unified scripting framework for Chromium, WebKit, and
|
||||
|
@ -8,8 +8,8 @@ title: Typed Arrays and ML
|
||||
</head>
|
||||
|
||||
Machine learning libraries in JS typically use "Typed Arrays". Typed Arrays are
|
||||
not JS Arrays! SheetJS expects bona fide JS Arrays. With some data wrangling,
|
||||
translating between SheetJS worksheets and typed arrays is straightforward.
|
||||
not JS Arrays! With some data wrangling, translating between SheetJS worksheets
|
||||
and typed arrays is straightforward.
|
||||
|
||||
This demo covers conversions between worksheets and Typed Arrays for use with
|
||||
[TensorFlow.js](https://js.tensorflow.org/js/) and other ML libraries.
|
||||
@ -43,7 +43,7 @@ function worksheet_to_csv_url(worksheet) {
|
||||
}
|
||||
```
|
||||
|
||||
[This demo mirrors TFjs docs](https://js.tensorflow.org/api/latest/#data.csv),
|
||||
[This demo mirrors `TFjs` docs](https://js.tensorflow.org/api/latest/#data.csv),
|
||||
fetching [an XLSX export of the example dataset](https://sheetjs.com/data/bht.xlsx).
|
||||
|
||||
<details><summary><b>TF CSV Demo using XLSX files</b> (click to show)</summary>
|
||||
@ -193,7 +193,7 @@ var sepal_lengths = [5.1, 4.9, ...];
|
||||
var sepal_widths = [3.5, 3, ...];
|
||||
```
|
||||
|
||||
When a 2D tensor can be exported, it will look different from the spreadsheet:
|
||||
When a `tensor2d` can be exported, it will look different from the spreadsheet:
|
||||
|
||||
```js
|
||||
var data_set_2d = [
|
||||
@ -292,7 +292,7 @@ var col1 = tensor.slice([0,0], [1,tensor.shape[1]]).flatten();
|
||||
var col2 = tensor.slice([1,0], [1,tensor.shape[1]]).flatten();
|
||||
```
|
||||
|
||||
For exporting, `stack` can be used to linearize the columns:
|
||||
For exporting, `stack` can be used to collapse the columns into a linear array:
|
||||
|
||||
```js
|
||||
/* pull data into a Float32Array */
|
||||
|
@ -169,9 +169,9 @@ bun bun.js
|
||||
</details>
|
||||
|
||||
|
||||
## ESBuild
|
||||
## esbuild
|
||||
|
||||
The `xlsx.mjs` source file are written in a subset of ES6 that ESBuild
|
||||
The `xlsx.mjs` source file are written in a subset of ES6 that `esbuild`
|
||||
understands and is able to transpile down for older browsers.
|
||||
|
||||
Both the `node` and `browser` platforms work out of the box.
|
||||
@ -339,7 +339,7 @@ node esb.node.js
|
||||
|
||||
## Parcel
|
||||
|
||||
Parcel Bundler should play nice with SheetJS out of the box.
|
||||
Parcel should play nice with SheetJS out of the box.
|
||||
|
||||
:::warning Parcel Bug
|
||||
|
||||
@ -846,7 +846,7 @@ While SystemJS works in NodeJS, the built-in `require` should be preferred.
|
||||
|
||||
:::
|
||||
|
||||
The NodeJS module entrypoint is `xlsx/xlsx.js` and should be mapped:
|
||||
The NodeJS module main script is `xlsx/xlsx.js` and should be mapped:
|
||||
|
||||
```js
|
||||
SystemJS.config({
|
||||
|
@ -65,7 +65,7 @@ npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
If you have [VSCodium](https://vscodium.com/) installed, the folder can be opened with
|
||||
If [VSCodium](https://vscodium.com/) is installed, the folder can be opened:
|
||||
|
||||
```powershell
|
||||
codium .
|
||||
@ -111,8 +111,8 @@ The `manifest.xml` should also be updated to reflect the function namespace:
|
||||
After making the change, save the files. Close the terminal window and the
|
||||
Excel window (do not save the Excel file). Re-run `npm start`.
|
||||
|
||||
In the new Excel window, enter the formula `=SHEETJS.VERSION()` in cell E1. You
|
||||
should see something similar to the following screenshot:
|
||||
In the new Excel window, enter the formula `=SHEETJS.VERSION()` in cell `E1`.
|
||||
You should see something similar to the following screenshot:
|
||||
|
||||
![`SHEETJS.VERSION` output](pathname:///files/xlcfversion.png)
|
||||
|
||||
@ -201,7 +201,7 @@ var aoa = XLSX.utils.sheet_to_json(ws, {header: 1}); // get data as array of arr
|
||||
|
||||
To demonstrate the parsing ability, a Base64-encoded version of the file will
|
||||
be used. This file contains no binary characters and should "just work". Once
|
||||
the aforementioned Excel bug is fixed, the non-Base64 version can be used.
|
||||
the aforementioned Excel bug is fixed, the raw binary files can be used.
|
||||
|
||||
This new function should be added to `src\functions\functions.js`:
|
||||
|
||||
@ -239,8 +239,8 @@ async function extern() {
|
||||
After making the change, save the files. Close the terminal window and the
|
||||
Excel window (do not save the Excel file). Re-run `npm start`.
|
||||
|
||||
Enter the formula `=SHEETJS.EXTERN()` in cell D1 and press Enter. Excel should
|
||||
pull in the data and generate a dynamic array:
|
||||
Enter the formula `=SHEETJS.EXTERN()` in cell `D1` and press Enter. Excel
|
||||
should pull in the data and generate a dynamic array:
|
||||
|
||||
![`SHEETJS.VERSION` output](pathname:///files/xlcfextern1.png)
|
||||
|
||||
|
@ -67,7 +67,7 @@ demo pages should be downloaded and hosted using a simple HTTP server.
|
||||
:::
|
||||
|
||||
<http://oss.sheetjs.com/sheetjs/ajax.html> uses XMLHttpRequest to download test
|
||||
files and convert to CSV.
|
||||
files and convert to CSV
|
||||
|
||||
<https://oss.sheetjs.com/sheetjs/> demonstrates reading files with `FileReader`.
|
||||
|
||||
@ -108,11 +108,11 @@ input_dom_element.addEventListener('change', handle_fr, false);
|
||||
|
||||
`Blob#arrayBuffer` is not supported in IE!
|
||||
|
||||
**ActiveX-based Upload**
|
||||
**ActiveX Upload**
|
||||
|
||||
Through the `Scripting.FileSystemObject` object model, a script in the VBScript
|
||||
scripting language can read from an arbitrary path on the filesystem. The shim
|
||||
includes a special `IE_LoadFile` function to read binary strings from file. This
|
||||
scripting language can read from an arbitrary path on the file system. The shim
|
||||
includes a special `IE_LoadFile` function to read binary data from files. This
|
||||
should be called from a file input `onchange` event:
|
||||
|
||||
```js
|
||||
@ -136,7 +136,7 @@ approach is embedded in `XLSX.writeFile` and no additional shims are necessary.
|
||||
|
||||
**Flash-based Download**
|
||||
|
||||
It is possible to write to the file system using a SWF. `Downloadify` library
|
||||
It is possible to write to the file system using a SWF file. `Downloadify`
|
||||
implements one solution. Since a genuine click is required, there is no way to
|
||||
force a download. The safest data type is Base64:
|
||||
|
||||
@ -159,7 +159,7 @@ Downloadify.create(element_id, {
|
||||
});
|
||||
```
|
||||
|
||||
**ActiveX-based Download**
|
||||
**ActiveX Download**
|
||||
|
||||
Through the `Scripting.FileSystemObject` object model, a script in the VBScript
|
||||
scripting language can write to an arbitrary path on the filesystem. The shim
|
||||
|
@ -7,8 +7,8 @@ import current from '/version.js';
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
With the availability of JS engines and the success of server-side runtimes, it
|
||||
is natural to want command-line tools for various workflows.
|
||||
With the availability of JS engines and the success of server-side platforms,
|
||||
it is feasible to build command-line tools for various workflows.
|
||||
|
||||
This demo covers a number of strategies for building standalone processors. The
|
||||
goal is to generate CSV output from an arbitrary spreadsheet file.
|
||||
@ -63,7 +63,7 @@ deno compile -r --allow-read sheet2csv.ts
|
||||
|
||||
## NodeJS
|
||||
|
||||
There are a few popular tools for compiling NodeJS scripts to executables.
|
||||
There are a few popular tools for compiling NodeJS scripts to CLI programs.
|
||||
|
||||
The demo script presents a friendly command line interface including flags:
|
||||
|
||||
|
@ -24,7 +24,7 @@ import and export data.
|
||||
|
||||
The `sheet_to_json` utility function generates arrays of objects, which is
|
||||
suitable for a number of libraries. When more advanced shapes are needed,
|
||||
it is easier to munge the output of an array of arrays.
|
||||
it is easier to process an array of arrays.
|
||||
|
||||
|
||||
### x-spreadsheet
|
||||
@ -204,7 +204,7 @@ many additional features including massive data streaming, sorting and styling.
|
||||
### Tabulator
|
||||
|
||||
[Tabulator](http://tabulator.info/docs/5.3/download#xlsx) includes deep support
|
||||
through a special Export button. It handles the SheetJS-related operations.
|
||||
through a special Export button. It handles the SheetJS operations internally.
|
||||
|
||||
|
||||
### Angular UI Grid
|
||||
@ -223,7 +223,7 @@ The [AngularJS demo](./legacy#angularjs) covers more general strategies.
|
||||
<details><summary><b>Notes</b> (click to show)</summary>
|
||||
|
||||
The library does not provide any way to modify the import button, so the demo
|
||||
includes a simple directive for a HTML File Input control. It also includes a
|
||||
includes a simple directive for a File Input HTML element. It also includes a
|
||||
sample service for export which adds an item to the export menu.
|
||||
|
||||
The demo `SheetJSImportDirective` follows the prescription from the README for
|
||||
@ -276,7 +276,7 @@ export default function App() {
|
||||
```
|
||||
|
||||
The most generic data representation is an array of arrays. To sate the grid,
|
||||
the columns must be objects whose `key` property is the stringified number:
|
||||
columns must be objects whose `key` property is the index converted to string:
|
||||
|
||||
```ts
|
||||
import { WorkSheet, utils } from 'xlsx';
|
||||
@ -314,11 +314,15 @@ function rdg_to_ws(rows: Row[]): WorkSheet {
|
||||
}
|
||||
```
|
||||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
#### RDG Demo
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
<details><summary><b>Complete Example</b> (click to show)</summary>
|
||||
|
||||
1) Create a new TypeScript CRA app:
|
||||
1) Create a new TypeScript `create-react-app` app:
|
||||
|
||||
```bash
|
||||
npx create-react-app sheetjs-cra --template typescript
|
||||
@ -333,7 +337,7 @@ npm i -S https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz react-data-grid
|
||||
|
||||
3) Replace the contents of `src/App.tsx` with the following code. Note: a copy
|
||||
to clipboard button will show up if you move your mouse over the code. The
|
||||
notable SheetJS-specific code is highlighted below:
|
||||
notable SheetJS integration code is highlighted below:
|
||||
|
||||
```tsx title="src/App.tsx"
|
||||
import React, { useEffect, useState, ChangeEvent } from "react";
|
||||
@ -444,8 +448,8 @@ export default function App() {
|
||||
}
|
||||
```
|
||||
|
||||
4) run `npm start`. When you load the dev page in the browser, it will attempt
|
||||
to fetch <https://sheetjs.com/pres.numbers> and load the data.
|
||||
4) run `npm start`. When you load the page in the browser, it will attempt to
|
||||
fetch <https://sheetjs.com/pres.numbers> and load the data.
|
||||
|
||||
The following screenshot was taken from the demo:
|
||||
|
||||
@ -453,8 +457,12 @@ The following screenshot was taken from the demo:
|
||||
|
||||
</details>
|
||||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
### vue3-table-lite
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
:::note
|
||||
|
||||
This demo was tested against `vue3-table-lite 1.2.4`, VueJS `3.2.37`, ViteJS
|
||||
@ -462,14 +470,13 @@ This demo was tested against `vue3-table-lite 1.2.4`, VueJS `3.2.37`, ViteJS
|
||||
|
||||
:::
|
||||
|
||||
[`vue3-table-lite`](https://vue3-lite-table.vercel.app/) is a data grid built
|
||||
for Vue
|
||||
[`vue3-table-lite`](https://vue3-lite-table.vercel.app/) is a VueJS data grid.
|
||||
|
||||
[A complete example is included below.](#vte-demo)
|
||||
[A complete example is included below.](#vuejs-demo)
|
||||
|
||||
#### Rows and Columns Bindings
|
||||
|
||||
`vue3-table-lite` presents two bindable attributes: an array of column metadata
|
||||
`vue3-table-lite` presents two attribute bindings: an array of column metadata
|
||||
(`columns`) and an array of objects representing the displayed data (`rows`).
|
||||
Typically both are `ref` objects:
|
||||
|
||||
@ -493,7 +500,7 @@ const columns = ref<Column[]>([]);
|
||||
</template>
|
||||
```
|
||||
|
||||
These can be mutated through the `value` property in Vue lifecycle methods:
|
||||
These can be mutated through the `value` property in VueJS lifecycle methods:
|
||||
|
||||
```ts
|
||||
import { onMounted } from "vue";
|
||||
@ -504,7 +511,7 @@ onMounted(() => {
|
||||
```
|
||||
|
||||
The most generic data representation is an array of arrays. To sate the grid,
|
||||
the columns must be objects whose `field` property is the stringified number:
|
||||
columns must be objects whose `field` property is the index converted to string:
|
||||
|
||||
```js
|
||||
import { ref } from "vue";
|
||||
@ -548,11 +555,11 @@ function vte_to_ws(rows) {
|
||||
}
|
||||
```
|
||||
|
||||
#### VTE Demo
|
||||
#### VueJS Demo
|
||||
|
||||
<details><summary><b>Complete Example</b> (click to show)</summary>
|
||||
|
||||
1) Create a new ViteJS App using the Vue + TypeScript template:
|
||||
1) Create a new ViteJS App using the VueJS + TypeScript template:
|
||||
|
||||
```bash
|
||||
npm create vite@latest sheetjs-vue -- --template vue-ts
|
||||
@ -575,7 +582,7 @@ curl -LO https://docs.sheetjs.com/vtl/App.vue
|
||||
cd ..
|
||||
```
|
||||
|
||||
4) run `npm run dev`. When you load the dev page in the browser, it will try
|
||||
to fetch <https://sheetjs.com/pres.numbers> and load the data.
|
||||
4) run `npm run dev`. When you load the page in the browser, it will try to
|
||||
fetch <https://sheetjs.com/pres.numbers> and load the data.
|
||||
|
||||
</details>
|
||||
|
@ -15,7 +15,7 @@ This library is compatible with Chrome and Chromium extensions and should just
|
||||
work out of the box. Specific API support is listed in the Chrome extensions
|
||||
API documentation.
|
||||
|
||||
[Right-Click and download the final crx](pathname:///chromium/SheetJSDemo.crx)
|
||||
[Right-Click and download the final CRX](pathname:///chromium/SheetJSDemo.crx)
|
||||
|
||||
:::caution
|
||||
|
||||
|
@ -5,12 +5,12 @@ title: Desktop Applications
|
||||
|
||||
Web technologies like JavaScript and HTML have been adapted to the traditional
|
||||
app space. Typically these frameworks bundle a JavaScript engine as well as a
|
||||
windowing framework. SheetJS is compatible with many toolkits.
|
||||
windowing framework. SheetJS is compatible with many app frameworks.
|
||||
|
||||
## NW.js
|
||||
|
||||
The [Standalone scripts](../getting-started/installation/standalone) can be referenced in a
|
||||
`SCRIPT` tag from the entry point HTML page.
|
||||
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.
|
||||
|
||||
@ -151,7 +151,7 @@ The demo project is wired for `electron-forge` to build the standalone binary.
|
||||
1) Download the demo files:
|
||||
|
||||
- [`package.json`](pathname:///electron/package.json) : project structure
|
||||
- [`main.js`](pathname:///electron/main.js) : entrypoint
|
||||
- [`main.js`](pathname:///electron/main.js) : main process script
|
||||
- [`index.html`](pathname:///electron/index.html) : window page
|
||||
- [`index.js`](pathname:///electron/index.js) : script loaded in render context
|
||||
|
||||
@ -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 file system.
|
||||
`showSaveDialog` shows a Save As dialog and returns the selected file name:
|
||||
|
||||
```js
|
||||
@ -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 file system.
|
||||
`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:
|
||||
|
||||
@ -343,20 +343,20 @@ Electron 12.0.0 and later also require `worldSafeExecuteJavascript: true` and
|
||||
`contextIsolation: true`.
|
||||
|
||||
Electron 14+ must use `@electron/remote` instead of `remote`. An `initialize`
|
||||
call is required to enable DevTools in the window.
|
||||
call is required to enable Developer Tools in the window.
|
||||
|
||||
:::
|
||||
|
||||
## Tauri
|
||||
|
||||
The [NodeJS Module](../getting-started/installation/nodejs) can be imported
|
||||
from frontend code.
|
||||
from JavaScript code.
|
||||
|
||||
This demo was tested against Tauri 1.0.5 on 2022 August 13.
|
||||
|
||||
:::note
|
||||
|
||||
Tauri currently does not provide NodeJS-esque `fs` wrapper functions. The raw
|
||||
Tauri currently does not provide the equivalent of NodeJS `fs` module. The raw
|
||||
`@tauri-apps/api` methods used in the examples are not expected to change.
|
||||
|
||||
:::
|
||||
@ -396,7 +396,7 @@ When prompted:
|
||||
- Window Title: `SheetJS + Tauri`
|
||||
- UI recipe: `create-vite`
|
||||
- Add "@tauri-apps/api": `Y`
|
||||
- Vite template: `vue-ts`
|
||||
- ViteJS template: `vue-ts`
|
||||
|
||||
2) Enter the directory:
|
||||
|
||||
|
@ -8,12 +8,12 @@ import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
The most popular JavaScript engine is V8. Designed for embedding in software,
|
||||
it powers Chrome, NodeJS, UXP, Deno and many other platforms and runtimes.
|
||||
it powers Chrome, NodeJS, UXP, Deno and many other platforms.
|
||||
|
||||
There are many other runtimes with different design goals. Some are designed
|
||||
There are many other JS engines with different design goals. Some are designed
|
||||
for low-power or low-memory environments. Others aim for interoperability with
|
||||
specific programming languages or environments. Typically they support a
|
||||
superset of ES3 and are capable of running SheetJS code.
|
||||
specific programming languages or environments. Typically they support ES3 and
|
||||
are capable of running SheetJS code.
|
||||
|
||||
|
||||
## General Caveats
|
||||
@ -40,9 +40,9 @@ var console = { log: function(x) { print(x); } };
|
||||
|
||||
**Binary Data**
|
||||
|
||||
Some engines do not provide easy ways of marshalling binary data. For example,
|
||||
it is common to pass null-terminated arrays, which would truncate XLSX and XLS
|
||||
files. APIs that accept pointers without length should be avoided.
|
||||
Some engines do not provide easy ways to exchange binary data. For example, it
|
||||
is common to pass null-terminated arrays, which would truncate XLSX, XLS, and
|
||||
other exports. APIs that accept pointers without length should be avoided.
|
||||
|
||||
Base64 strings are safe for passing between JS and native code, but they should
|
||||
only be used when there is no safe way to pass `ArrayBuffer` or `Uint8Array`.
|
||||
@ -81,7 +81,7 @@ duk_pop(ctx);
|
||||
|
||||
:::note
|
||||
|
||||
This demo was tested on MacOS x64.
|
||||
This demo was tested on Intel Mac (`darwin-x64`).
|
||||
|
||||
:::
|
||||
|
||||
@ -256,7 +256,7 @@ wb, _ = vm.RunString("wb = XLSX.read(buf, {type:'buffer'});")
|
||||
`"base64"` strings can be decoded in Go:
|
||||
|
||||
```go
|
||||
/* write to base64 string */
|
||||
/* write to Base64 string */
|
||||
b64str, _ := vm.RunString("XLSX.write(wb, {type:'base64', bookType:'xlsx'})")
|
||||
|
||||
/* pull data back into Go and write to file */
|
||||
@ -430,7 +430,7 @@ cat global.js xlsx.full.min.js payload.js hermes.js > xlsx.hermes.js
|
||||
```
|
||||
|
||||
The final script defines `global` before loading the standalone library. Once
|
||||
ready, it will read the hardcoded test file and print the contents as CSV.
|
||||
ready, it will read the bundled test data and print the contents as CSV.
|
||||
|
||||
5) Run the script using the Hermes standalone binary:
|
||||
|
||||
@ -461,7 +461,7 @@ Binary strings can be passed back and forth using `String.Encoding.isoLatin1`.
|
||||
`String(contentsOf:encoding:)` reads from a path and returns an encoded string:
|
||||
|
||||
```swift
|
||||
/* read sheetjs.xls as base64 string */
|
||||
/* read sheetjs.xls as Base64 string */
|
||||
let file_path = shared_dir.appendingPathComponent("sheetjs.xls");
|
||||
let data: String! = try String(contentsOf: file_path, encoding: String.Encoding.isoLatin1);
|
||||
```
|
||||
@ -478,8 +478,8 @@ context.evaluateScript("var wb = XLSX.read(payload, {type:'binary'});");
|
||||
|
||||
**Writing data**
|
||||
|
||||
When writing to binary string in JSC, the result should be stored in a variable
|
||||
and stringified in Swift:
|
||||
When writing to binary string in JavaScriptCore, the result should be stored in
|
||||
a variable and converted to string in Swift:
|
||||
|
||||
```swift
|
||||
/* write to binary string */
|
||||
@ -618,7 +618,7 @@ cat global.js xlsx.full.min.js payload.js jerry.js > xlsx.jerry.js
|
||||
```
|
||||
|
||||
The final script defines `global` before loading the standalone library. Once
|
||||
ready, it will read the hardcoded test file and print the contents as CSV.
|
||||
ready, it will read the bundled test data and print the contents as CSV.
|
||||
|
||||
5) Run the script using the `jerry` standalone binary:
|
||||
|
||||
@ -834,7 +834,7 @@ cat global.js xlsx.full.min.js payload.js chakra.js > xlsx.chakra.js
|
||||
```
|
||||
|
||||
The final script defines `global` before loading the standalone library. Once
|
||||
ready, it will read the hardcoded test file and print the contents as CSV.
|
||||
ready, it will read the bundled test data and print the contents as CSV.
|
||||
|
||||
5) Run the script using the ChakraCore standalone binary:
|
||||
|
||||
|
@ -68,7 +68,7 @@ The following table lists tested file plugins. "OS" lists tested platforms
|
||||
("A" for Android and "I" for iOS). "Copy" indicates whether an explicit copy
|
||||
is needed (file picker copies to cache directory and file plugin reads cache).
|
||||
|
||||
| Filesystem Plugin | File Picker Plugin | OS | Copy |
|
||||
| File system Plugin | File Picker Plugin | OS | Copy |
|
||||
|:---------------------------|:-------------------------------|:----:|:-----|
|
||||
| `react-native-file-access` | `react-native-document-picker` | `AI` | |
|
||||
| `react-native-blob-util` | `react-native-document-picker` | `AI` | YES |
|
||||
@ -165,7 +165,7 @@ const wb = XLSX.read(new Uint8Array(res), {type:'buffer'});
|
||||
|
||||
:::caution
|
||||
|
||||
On iOS, URIs from `react-native-document-picker` must be massaged:
|
||||
On iOS, the URI from `react-native-document-picker` must be massaged:
|
||||
|
||||
```js
|
||||
import { pickSingle } from 'react-native-document-picker';
|
||||
@ -218,7 +218,7 @@ import * as XLSX from "xlsx";
|
||||
import { FileSystem } from "react-native-file-access";
|
||||
|
||||
const b64 = await FileSystem.readFile(path, "base64");
|
||||
/* b64 is a base64 string */
|
||||
/* b64 is a Base64 string */
|
||||
const workbook = XLSX.read(b64, {type: "base64"});
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ import { Dirs, FileSystem } from "react-native-file-access";
|
||||
const DDP = Dirs.DocumentDir + "/";
|
||||
|
||||
const b64 = XLSX.write(workbook, {type:'base64', bookType:"xlsx"});
|
||||
/* b64 is a base64 string */
|
||||
/* b64 is a Base64 string */
|
||||
await FileSystem.writeFile(DDP + "sheetjs.xlsx", b64, "base64");
|
||||
```
|
||||
|
||||
@ -270,7 +270,7 @@ await writeFile(DocumentDirectoryPath + "/sheetjs.xlsx", bstr, "ascii");
|
||||
|
||||
:::caution
|
||||
|
||||
Some Expo APIs return URIs that cannot be read with `expo-file-system`. This
|
||||
Some Expo APIs return URI that cannot be read with `expo-file-system`. This
|
||||
will manifest as an error:
|
||||
|
||||
> Unsupported scheme for location '...'
|
||||
@ -305,7 +305,7 @@ import * as XLSX from "xlsx";
|
||||
import * as FileSystem from 'expo-file-system';
|
||||
|
||||
const b64 = XLSX.write(workbook, {type:'base64', bookType:"xlsx"});
|
||||
/* b64 is a base64 string */
|
||||
/* b64 is a Base64 string */
|
||||
await FileSystem.writeAsStringAsync(FileSystem.documentDirectory + "sheetjs.xlsx", b64, { encoding: FileSystem.EncodingType.Base64 });
|
||||
```
|
||||
|
||||
@ -326,9 +326,9 @@ are not covered here.
|
||||
|
||||
This example tries to separate the library-specific functions.
|
||||
|
||||
0) **Follow the official React Native CLI Quickstart!**
|
||||
0) **Follow the official React Native CLI Guide!**
|
||||
|
||||
Quickstart URL: <http://reactnative.dev/docs/environment-setup>
|
||||
Development Environment Guide: <http://reactnative.dev/docs/environment-setup>
|
||||
|
||||
Follow the instructions for iOS and for Android. They will cover installation
|
||||
and system configuration. By the end, you should be able to run the sample app
|
||||
@ -587,7 +587,7 @@ pod install
|
||||
cd ..
|
||||
```
|
||||
|
||||
After doing this, the simulator must be stopped and the dev server must reload:
|
||||
Once refreshed, the development process must be restarted:
|
||||
|
||||
```bash
|
||||
npx react-native run-ios
|
||||
@ -625,7 +625,7 @@ find ~/Library/Developer/CoreSimulator -name sheetjsw.xlsx |
|
||||
while read x; do echo "$x"; npx xlsx-cli "$x"; done
|
||||
```
|
||||
|
||||
Once testing is complete, stop the simulator and the dev process.
|
||||
Once testing is complete, stop the simulator and the development process.
|
||||
|
||||
**Android Testing**
|
||||
|
||||
@ -674,7 +674,7 @@ on an iPhone SE 3rd generation.
|
||||
|
||||
:::warning Binary Data issues
|
||||
|
||||
NativeScript will not safely transmit binary or UTF8 strings. XLSB, NUMBERS,
|
||||
NativeScript will not safely transmit binary or UTF-8 strings. XLSB, NUMBERS,
|
||||
XLSX, XLS, ODS, SYLK, and DBF exports are known to be mangled.
|
||||
|
||||
[This is a known NativeScript bug](https://github.com/NativeScript/NativeScript/issues/9586)
|
||||
@ -731,7 +731,7 @@ await file.writeText(bstr, encoding.ISO_8859_1);
|
||||
### Demo
|
||||
|
||||
The demo builds off of the NativeScript + Angular example. Familiarity with
|
||||
with Angular and TypeScript is assumed.
|
||||
Angular and TypeScript is assumed.
|
||||
|
||||
<details><summary><b>Complete Example</b> (click to show)</summary>
|
||||
|
||||
@ -1088,7 +1088,7 @@ window.requestFileSystem(window.PERSISTENT, 0, function(fs) {
|
||||
|
||||
### Demo
|
||||
|
||||
The demo builds off of the Vite example. Familiarity with VueJS and TypeScript
|
||||
The demo draws from the ViteJS example. Familiarity with VueJS and TypeScript
|
||||
is assumed.
|
||||
|
||||
<details><summary><b>Complete Example</b> (click to show)</summary>
|
||||
@ -1107,6 +1107,8 @@ npm i -g @quasar/cli cordova
|
||||
npm init quasar
|
||||
```
|
||||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
When prompted:
|
||||
|
||||
- "What would you like to build?": `App with Quasar CLI`
|
||||
@ -1125,6 +1127,8 @@ When prompted:
|
||||
|
||||
2) Install dependencies:
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
```bash
|
||||
cd SheetJSQuasar
|
||||
npm i
|
||||
@ -1166,7 +1170,7 @@ Return to the project directory:
|
||||
cd ..
|
||||
```
|
||||
|
||||
4) Start the dev server:
|
||||
4) Start the development server:
|
||||
|
||||
```bash
|
||||
quasar dev -m ios
|
||||
@ -1174,7 +1178,8 @@ quasar dev -m ios
|
||||
|
||||
:::caution
|
||||
|
||||
If the app is blank, delete the app and close the simulator, then restart dev
|
||||
If the app is blank or not refreshing, delete the app and close the simulator,
|
||||
then restart the development process.
|
||||
|
||||
:::
|
||||
|
||||
@ -1228,7 +1233,7 @@ The app should now show two buttons at the bottom:
|
||||
:::caution
|
||||
|
||||
If the app is blank or not refreshing, delete the app and close the simulator,
|
||||
then restart the dev process.
|
||||
then restart the development process.
|
||||
|
||||
:::
|
||||
|
||||
@ -1372,7 +1377,7 @@ id,content
|
||||
|
||||
:::note
|
||||
|
||||
This demo was tested on an Intel Mac on 2022 August 18 with Cordova backend.
|
||||
This demo was tested on an Intel Mac on 2022 August 18 with Cordova.
|
||||
The file integration uses `@ionic-native/file` version `5.36.0`.
|
||||
|
||||
The iOS simulator runs iOS 15.5 on an iPod Touch 7th Gen.
|
||||
|
@ -5,7 +5,7 @@ title: VueJS
|
||||
|
||||
[VueJS](https://vuejs.org/) is a JS library for building user interfaces.
|
||||
|
||||
This demo tries to cover common Vue data flow ideas and strategies. Single-File
|
||||
This demo covers common VueJS data flow ideas and strategies. Single-File
|
||||
Components (SFC) and VueJS familiarity is assumed.
|
||||
|
||||
Other demos cover general VueJS deployments, including:
|
||||
@ -163,8 +163,8 @@ generate column headings and for indexing into the row objects.
|
||||
The safest approach is to use an array of arrays for state and to generate
|
||||
column objects that map to A1-Style column headers.
|
||||
|
||||
The [Vue Table Lite demo](./grid#rows-and-columns-bindings) uses this approach
|
||||
with the following column and row structure:
|
||||
The [`vue3-table-lite` demo](./grid#rows-and-columns-bindings) generates rows
|
||||
and columns objects with the following structure:
|
||||
|
||||
```js
|
||||
/* rows are generated with a simple array of arrays */
|
||||
|
@ -20,9 +20,9 @@ Other demos cover general Angular deployments, including:
|
||||
|
||||
:::warning
|
||||
|
||||
Angular dev tooling uses native NodeJS modules. There are a number of issues
|
||||
when trying to run Angular projects with different NodeJS versions. These
|
||||
issues should be directed to the Angular project.
|
||||
Angular tooling uses native NodeJS modules. There are a number of issues when
|
||||
trying to run Angular projects with different NodeJS versions. These issues
|
||||
should be directed to the Angular project.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -93,7 +93,7 @@ var XLSX = require('xlsx');
|
||||
exports.handler = function(event, context, callback) {
|
||||
/* make workbook */
|
||||
var wb = XLSX.read("S,h,e,e,t,J,S\n5,4,3,3,7,9,5", {type: "binary"});
|
||||
/* write to XLSX file in base64 encoding */
|
||||
/* write to XLSX file in Base64 encoding */
|
||||
// highlight-next-line
|
||||
var body = XLSX.write(wb, {type:"base64", bookType: "xlsx"});
|
||||
/* mark as attached file */
|
||||
|
@ -6,7 +6,8 @@ hide_table_of_contents: true
|
||||
|
||||
# Demo Projects
|
||||
|
||||
The demo projects include small runnable examples and short explainers.
|
||||
Demos include complete examples and short discussions. For features that can
|
||||
run in the web browser, demos will include interactive examples.
|
||||
|
||||
### JavaScript APIs
|
||||
|
||||
|
@ -326,7 +326,7 @@ The [`server` demo](../demos/server) has more advanced examples.
|
||||
</TabItem>
|
||||
<TabItem value="deno" label="Deno">
|
||||
|
||||
[Drash](https://drash.land/drash/) is a framework for Deno's HTTP server. In a
|
||||
[Drash](https://drash.land/drash/) is a HTTP server framework for Deno. In a
|
||||
`POST` request handler, the body parser can pull file data into a `Uint8Array`:
|
||||
|
||||
<pre><code parentName="pre" {...{"className": "language-ts"}}>{`\
|
||||
|
@ -45,8 +45,8 @@ _Access the first Worksheet_
|
||||
var first_ws = workbook.Sheets[workbook.SheetNames[0]];
|
||||
```
|
||||
|
||||
Combining the previous examples, `workbook.Sheets[workbook.SheetNames[n]]` is
|
||||
the `n`-th worksheet if it exists in the workbook.
|
||||
Combining the previous examples, `workbook.Sheets[workbook.SheetNames[0]]` is
|
||||
the first worksheet if it exists in the workbook.
|
||||
|
||||
|
||||
_Replace a Worksheet in place_
|
||||
|
@ -448,27 +448,10 @@ is to adjust the server process or Lambda function to accept Base64 strings.
|
||||
|
||||
:::
|
||||
|
||||
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):
|
||||
A complete example using XHR is [included in the XHR demo](../demos/network),
|
||||
along with examples for fetch and wrapper libraries.
|
||||
|
||||
```js
|
||||
/* in this example, send a base64 string to the server */
|
||||
var wbout = XLSX.write(workbook, { bookType: "xlsx", type: "base64" });
|
||||
|
||||
/* prepare data for POST */
|
||||
var formdata = new FormData();
|
||||
formdata.append("file", "test.xlsx"); // <-- server expects `file` to hold name
|
||||
formdata.append("data", wbout); // <-- `data` holds the base64-encoded data
|
||||
|
||||
/* perform POST request */
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("POST", "/upload", true);
|
||||
req.send(formdata);
|
||||
```
|
||||
|
||||
For servers that do not parse POST request bodies as UTF-8 strings, a `Blob` can
|
||||
be generated from the `array` output:
|
||||
Under normal circumstances, a `Blob` can be generated from the `array` output:
|
||||
|
||||
```js
|
||||
/* in this example, send a Blob to the server */
|
||||
@ -481,6 +464,24 @@ formdata.append("file", blob, "test.xlsx");
|
||||
|
||||
/* perform POST request */
|
||||
fetch("/upload", { method: 'POST', body: formdata });
|
||||
```
|
||||
|
||||
When binary data is not supported, Base64 strings should be passed along. This
|
||||
will require the server to expect and decode the data:
|
||||
|
||||
```js
|
||||
/* in this example, send a Base64 string to the server */
|
||||
var wbout = XLSX.write(workbook, { bookType: "xlsx", type: "base64" });
|
||||
|
||||
/* prepare data for POST */
|
||||
var formdata = new FormData();
|
||||
formdata.append("file", "test.xlsx"); // <-- server expects `file` to hold name
|
||||
formdata.append("data", wbout); // <-- `data` holds the data encoded in Base64
|
||||
|
||||
/* perform POST request */
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("POST", "/upload", true);
|
||||
req.send(formdata);
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@ -753,7 +754,7 @@ _Generate a CSV from a single worksheet_
|
||||
var csv = XLSX.utils.sheet_to_csv(worksheet, opts);
|
||||
```
|
||||
|
||||
This snapshot is designed to replicate the "CSV UTF8 (`.csv`)" output type.
|
||||
This snapshot is designed to replicate the "CSV UTF-8 (`.csv`)" output type.
|
||||
["Delimiter-Separated Output"](../api/utilities#delimiter-separated-output) describes the
|
||||
function and the optional `opts` argument in more detail.
|
||||
|
||||
@ -763,7 +764,7 @@ _Generate "Text" from a single worksheet_
|
||||
var txt = XLSX.utils.sheet_to_txt(worksheet, opts);
|
||||
```
|
||||
|
||||
This snapshot is designed to replicate the "UTF16 Text (`.txt`)" output type.
|
||||
This snapshot is designed to replicate the "UTF-16 Text (`.txt`)" output type.
|
||||
["Delimiter-Separated Output"](../api/utilities#delimiter-separated-output) describes the
|
||||
function and the optional `opts` argument in more detail.
|
||||
|
||||
|
@ -42,7 +42,7 @@ A1-Style is the default address style in Lotus 1-2-3 and Excel.
|
||||
Columns are specified with letters, counting from `A` to `Z`, then `AA` to `ZZ`,
|
||||
then `AAA`. Some sample values, along with SheetJS column indices, are listed:
|
||||
|
||||
| Ordinal | A1 Name | SheetJS |
|
||||
| Ordinal | `A1` | SheetJS |
|
||||
|:--------|:--------|--------:|
|
||||
| First | `A` | `0` |
|
||||
| Second | `B` | `1` |
|
||||
@ -78,7 +78,7 @@ fourth columns.
|
||||
A row range is represented by the top-most row, followed by `:`, followed by the
|
||||
bottom-most column. For example, `2:4` represents the second/third/fourth rows.
|
||||
|
||||
### A1 Utilities
|
||||
### Utilities
|
||||
|
||||
#### Column Names
|
||||
|
||||
|
@ -8,7 +8,7 @@ Excel supports 4 different types of "sheets":
|
||||
- "worksheets": normal sheets
|
||||
- "chartsheets": full-tab charts
|
||||
- "macrosheets": legacy (pre-VBA) macros
|
||||
- "dialogsheets": legacy (pre-VBA) dialogs
|
||||
- "dialogsheets": legacy (pre-VBA) dialog windows
|
||||
|
||||
## Generic Sheet Object
|
||||
|
||||
|
@ -18,7 +18,7 @@ while the writer will translate from A1-Style strings to the file format.
|
||||
| XLSB | ✔ | | ✔ | ✔ | BIFF parsed tokens |
|
||||
| XLS | ✔ | | ✔ | | BIFF parsed tokens |
|
||||
| XLML | ✔ | ✔ | ✔ | | RC-style strings |
|
||||
| SYLK | ✔ | ✔ | | | A1 / RC-style strings |
|
||||
| SYLK | ✔ | ✔ | | | `A1`/RC-style strings |
|
||||
| CSV / TXT | ✔ | ✔ | | | A1-Style strings |
|
||||
| ODS / FODS / UOS | ✔ | ✔ | | | OpenFormula strings |
|
||||
| WK\* | ✔ | | | | Lotus parsed tokens |
|
||||
@ -51,7 +51,7 @@ const workbook = XLSX.read(ab, { cellFormula: true });
|
||||
<TabItem value="nodejs" label="NodeJS">
|
||||
|
||||
Typically file data will be available as a `Buffer` from a network request / API
|
||||
or stored in the filesystem. `cellFormula: true` should be added to the second
|
||||
or stored in the file system. `cellFormula: true` should be added to the second
|
||||
options argument to `read` or `readFile`:
|
||||
|
||||
**`XLSX.read`**
|
||||
@ -75,8 +75,8 @@ const workbook = XLSX.readFile("test.xlsx", { cellFormula: true });
|
||||
<TabItem value="bun" label="Bun">
|
||||
|
||||
Typically file data will be available as a `Uint8Array` from a network request
|
||||
or stored in the filesystem. `cellFormula: true` should be added to the second
|
||||
options argument to `read` or `readFile`:
|
||||
or stored in the file system. `cellFormula: true` should be set in the options
|
||||
argument to `read` or `readFile`:
|
||||
|
||||
**`XLSX.read`**
|
||||
|
||||
@ -98,9 +98,9 @@ const workbook = XLSX.readFile("test.xlsx", { cellFormula: true });
|
||||
</TabItem>
|
||||
<TabItem value="deno" label="Deno">
|
||||
|
||||
Typically file data will be available as a `Uint8Array` / `ArrayBuffer` from an
|
||||
API or stored in the filesystem. `cellFormula: true` should be added to the
|
||||
second options argument to `read` or `readFile`:
|
||||
Typically file data will be available as a `Uint8Array` or `ArrayBuffer` from
|
||||
API or stored in the file system. `cellFormula: true` should be set in the
|
||||
options argument to `read` or `readFile`:
|
||||
|
||||
**`XLSX.read`**
|
||||
|
||||
@ -128,11 +128,11 @@ The A1-Style formula string is stored in the `f` field of the cell object.
|
||||
Spreadsheet software typically represent formulae with a leading `=` sign, but
|
||||
SheetJS formulae omit the `=`.
|
||||
|
||||
["A1-Style"](../general#a1-style) describes A1 style in more detail.
|
||||
["A1-Style"](../general#a1-style) describes A1-Style in more detail.
|
||||
|
||||
For example, consider [this test file](pathname:///files/concat.xlsx):
|
||||
|
||||
![`D1=CONCAT("Sheet", "JS")`](pathname:///files/concat.png)
|
||||
![Screenshot](pathname:///files/concat.png)
|
||||
|
||||
```jsx live
|
||||
/* The live editor requires this function wrapper */
|
||||
|
@ -59,8 +59,8 @@ The following table covers some common formats:
|
||||
| `mm` | Long (2-digit) minutes |
|
||||
| `s` | Short (1-digit) seconds |
|
||||
| `ss` | Long (2-digit) seconds |
|
||||
| `A/P` | Meridien ("A" or "P") |
|
||||
| `AM/PM` | Meridien ("AM" or "PM") |
|
||||
| `A/P` | Meridiem ("A" or "P") |
|
||||
| `AM/PM` | Meridiem ("AM" or "PM") |
|
||||
|
||||
:::note
|
||||
|
||||
@ -144,8 +144,8 @@ Excel and other spreadsheet software, but this represents .
|
||||
XLS, XLSB, and most binary formats store the raw date codes. Special number
|
||||
formats are used to indicate that the values are intended to be dates/times.
|
||||
|
||||
CSV and other plaintext formats typically store actual formatted date values.
|
||||
They are interpreted as dates and times in the user timezone.
|
||||
CSV and other text formats typically store actual formatted date values. They
|
||||
are interpreted as dates and times in the user timezone.
|
||||
|
||||
XLSX actually supports both! Typically dates are stored as `n` numeric cells,
|
||||
but the format supports a special type `d` where the data is an ISO 8601 date
|
||||
@ -175,7 +175,7 @@ with an appropriate number format.
|
||||
The actual values stored in cells are intended to be correct from the
|
||||
perspective of an Excel user in the current timezone.
|
||||
|
||||
The value formatter understands date formats and converts when relevant.
|
||||
The value formatting logic understands date formats and converts when relevant.
|
||||
|
||||
### Utility Functions
|
||||
|
||||
|
@ -6,7 +6,7 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
||||
Even for basic features like date storage, the official Excel formats store the
|
||||
same content in different ways. The parsers are expected to convert from the
|
||||
underlying file format representation to the Common Spreadsheet Format. Writers
|
||||
are expected to convert from CSF back to the underlying file format.
|
||||
are expected to serialize SheetJS workbooks in the underlying file format.
|
||||
|
||||
The following topics are covered in sub-pages:
|
||||
|
||||
@ -124,11 +124,11 @@ follow the priority order:
|
||||
|
||||
_Column Widths_
|
||||
|
||||
Given the constraints, it is possible to determine the MDW without actually
|
||||
Given the constraints, it is possible to determine the `MDW` without actually
|
||||
inspecting the font! The parsers guess the pixel width by converting from width
|
||||
to pixels and back, repeating for all possible MDW and selecting the MDW that
|
||||
minimizes the error. XLML actually stores the pixel width, so the guess works
|
||||
in the opposite direction.
|
||||
to pixels and back, repeating for all possible `MDW` and selecting the value
|
||||
that minimizes the error. XLML actually stores the pixel width, so the guess
|
||||
works in the opposite direction.
|
||||
|
||||
Even though all of the information is made available, writers are expected to
|
||||
follow the priority order:
|
||||
@ -144,7 +144,7 @@ follow the priority order:
|
||||
The `cell.w` formatted text for each cell is produced from `cell.v` and `cell.z`
|
||||
format. If the format is not specified, the Excel `General` format is used.
|
||||
The format can either be specified as a string or as an index into the format
|
||||
table. Parsers are expected to populate `workbook.SSF` with the number format
|
||||
table. Readers are expected to populate `workbook.SSF` with the number format
|
||||
table. Writers are expected to serialize the table.
|
||||
|
||||
The following example creates a custom format from scratch:
|
||||
@ -299,7 +299,7 @@ The visibility setting is stored in the `Hidden` property of sheet props array.
|
||||
If the respective Sheet entry does not exist or if the `Hidden` property is not
|
||||
set, the worksheet is visible.
|
||||
|
||||
**List all worksheets and their visibilities**
|
||||
**List all worksheets and their visibility settings**
|
||||
|
||||
```js
|
||||
wb.Workbook.Sheets.map(function(x) { return [x.name, x.Hidden] })
|
||||
|
@ -7,7 +7,7 @@ title: Common Spreadsheet Format
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
||||
|
||||
The "Common Spreadsheet Format" (CSF) is the object model used by SheetJS. This
|
||||
The "Common Spreadsheet Format" is the object model used by SheetJS. This
|
||||
section covers the JS representation of workbooks, worksheets, cells, ranges,
|
||||
addresses and other features.
|
||||
|
||||
|
@ -57,7 +57,7 @@ The read functions accept an options argument:
|
||||
- `bookVBA` merely exposes the raw VBA CFB object. It does not parse the data.
|
||||
XLSM and XLSB store the VBA CFB object in `xl/vbaProject.bin`. BIFF8 XLS mixes
|
||||
the VBA entries alongside the core Workbook entry, so the library generates a
|
||||
new XLSB-compatible blob from the XLS CFB container.
|
||||
new blob from the XLS CFB container that works in XLSM and XLSB files.
|
||||
- `codepage` is applied to BIFF2 - BIFF5 files without `CodePage` records and to
|
||||
CSV files without BOM in `type:"binary"`. BIFF8 XLS always defaults to 1200.
|
||||
- `PRN` affects parsing of text files without a common delimiter character.
|
||||
@ -78,7 +78,7 @@ tells the library how to parse the data argument:
|
||||
|------------|-----------------------------------------------------------------|
|
||||
| `"base64"` | string: Base64 encoding of the file |
|
||||
| `"binary"` | string: binary string (byte `n` is `data.charCodeAt(n)`) |
|
||||
| `"string"` | string: JS string (characters interpreted as UTF8) |
|
||||
| `"string"` | string: JS string (only appropriate for UTF-8 text formats) |
|
||||
| `"buffer"` | nodejs Buffer |
|
||||
| `"array"` | array: array of 8-bit unsigned int (byte `n` is `data[n]`) |
|
||||
| `"file"` | string: path of file that will be read (nodejs only) |
|
||||
@ -101,8 +101,8 @@ file but Excel will know how to handle it. This library applies similar logic:
|
||||
| `0x50` | ZIP Archive | XLSB or XLSX/M or ODS or UOS2 or NUMBERS or text |
|
||||
| `0x49` | Plain Text | SYLK or plain text |
|
||||
| `0x54` | Plain Text | DIF or plain text |
|
||||
| `0xEF` | UTF8 Encoded | SpreadsheetML / Flat ODS / UOS1 / HTML / plain text |
|
||||
| `0xFF` | UTF16 Encoded | SpreadsheetML / Flat ODS / UOS1 / HTML / plain text |
|
||||
| `0xEF` | UTF-8 Text | SpreadsheetML / Flat ODS / UOS1 / HTML / plain text |
|
||||
| `0xFF` | UTF-16 Text | SpreadsheetML / Flat ODS / UOS1 / HTML / plain text |
|
||||
| `0x00` | Record Stream | Lotus WK\* or Quattro Pro or plain text |
|
||||
| `0x7B` | Plain text | RTF or plain text |
|
||||
| `0x0A` | Plain text | SpreadsheetML / Flat ODS / UOS1 / HTML / plain text |
|
||||
@ -112,7 +112,7 @@ file but Excel will know how to handle it. This library applies similar logic:
|
||||
DBF files are detected based on the first byte as well as the third and fourth
|
||||
bytes (corresponding to month and day of the file date)
|
||||
|
||||
Works for Windows files are detected based on the BOF record with type `0xFF`
|
||||
Works for Windows files are detected based on the `BOF` record with type `0xFF`
|
||||
|
||||
Plain text format guessing follows the priority order:
|
||||
|
||||
|
@ -201,7 +201,7 @@ The `type` argument for `write` mirrors the `type` argument for `read`:
|
||||
|------------|-----------------------------------------------------------------|
|
||||
| `"base64"` | string: Base64 encoding of the file |
|
||||
| `"binary"` | string: binary string (byte `n` is `data.charCodeAt(n)`) |
|
||||
| `"string"` | string: JS string (characters interpreted as UTF8) |
|
||||
| `"string"` | string: JS string (not compatible with binary formats) |
|
||||
| `"buffer"` | nodejs Buffer |
|
||||
| `"array"` | ArrayBuffer, fallback array of 8-bit unsigned int |
|
||||
| `"file"` | string: path of file that will be created (nodejs only) |
|
||||
|
@ -81,7 +81,7 @@ accepts an options argument:
|
||||
| (string) | Use specified cell (A1-Style cell) |
|
||||
| (number >= 0) | Start from the first column at specified row (0-indexed) |
|
||||
| -1 | Append to bottom of worksheet starting on first column |
|
||||
| (default) | Start from cell A1 |
|
||||
| (default) | Start from cell `A1` |
|
||||
|
||||
|
||||
The example worksheet can be built up in the order `A1:G1, A2:B4, E2:G4, A5:G5`:
|
||||
@ -206,7 +206,7 @@ an options argument:
|
||||
| (string) | Use specified cell (A1-Style cell) |
|
||||
| (number >= 0) | Start from the first column at specified row (0-indexed) |
|
||||
| -1 | Append to bottom of worksheet starting on first column |
|
||||
| (default) | Start from cell A1 |
|
||||
| (default) | Start from cell `A1` |
|
||||
|
||||
|
||||
This example worksheet can be built up in the order `A1:G1, A2:B4, E2:G4, A5:G5`:
|
||||
@ -269,7 +269,7 @@ function SheetJSHeaderOrder() {
|
||||
|
||||
### HTML Table Input
|
||||
|
||||
**Create a worksheet or workbook from a HTML DOM TABLE**
|
||||
**Create a worksheet or workbook from a TABLE element**
|
||||
|
||||
```js
|
||||
var ws = XLSX.utils.table_to_sheet(elt, opts);
|
||||
@ -329,7 +329,7 @@ var ws = wb.Sheets[wb.SheetNames[0]];
|
||||
|
||||
:::
|
||||
|
||||
**Add data from a HTML DOM TABLE to an existing worksheet**
|
||||
**Add data from a TABLE element to an existing worksheet**
|
||||
|
||||
```js
|
||||
XLSX.utils.sheet_add_dom(ws, elt, opts);
|
||||
@ -355,7 +355,7 @@ an options argument:
|
||||
| (string) | Use specified cell (A1-Style cell) |
|
||||
| (number >= 0) | Start from the first column at specified row (0-indexed) |
|
||||
| -1 | Append to bottom of worksheet starting on first column |
|
||||
| (default) | Start from cell A1 |
|
||||
| (default) | Start from cell `A1` |
|
||||
|
||||
|
||||
A common use case for `sheet_add_dom` involves adding multiple tables to a
|
||||
@ -480,7 +480,7 @@ var txt = XLSX.utils.sheet_to_txt(ws, opts);
|
||||
|
||||
The `txt` output type uses the tab character as the field separator. If the
|
||||
`codepage` library is available (included in full distribution but not core),
|
||||
the output will be encoded in `CP1200` and the BOM will be prepended.
|
||||
the output will be encoded in `CP1200` and the UTF-16 BOM will be added.
|
||||
|
||||
`XLSX.utils.sheet_to_txt` takes the same arguments as `sheet_to_csv`.
|
||||
|
||||
@ -566,7 +566,7 @@ takes an options argument:
|
||||
|
||||
| `header` | Description |
|
||||
| :--------------- | :-------------------------------------------------------- |
|
||||
| `1` | Generate an array of arrays ("2D Array") |
|
||||
| `1` | Generate an array of arrays |
|
||||
| `"A"` | Row object keys are literal column labels |
|
||||
| array of strings | Use specified strings as keys in row objects |
|
||||
| (default) | Read and disambiguate first row as keys |
|
||||
|
@ -42,7 +42,7 @@ Write options are described in the [Writing Options](./write-options) section.
|
||||
|
||||
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#utilities)
|
||||
|
||||
**Cell and cell address manipulation:**
|
||||
|
||||
@ -71,9 +71,9 @@ The following are described in the [Utility Functions](./utilities):
|
||||
|
||||
- `sheet_to_json` converts a worksheet object to an array of JSON objects.
|
||||
- `sheet_to_csv` generates delimiter-separated-values output.
|
||||
- `sheet_to_txt` generates UTF16 formatted text.
|
||||
- `sheet_to_txt` generates UTF-16 formatted text.
|
||||
- `sheet_to_html` generates HTML output.
|
||||
- `sheet_to_formulae` generates a list of the formulae (with value fallbacks).
|
||||
- `sheet_to_formulae` generates a list of formulae or cell value assignments.
|
||||
|
||||
**Miscellaneous**
|
||||
|
||||
@ -96,7 +96,7 @@ Due to broad inconsistencies in ESM implementations, the `mjs` build does not
|
||||
import any dependencies. Instead, they must be manually passed to the library:
|
||||
|
||||
`XLSX.set_cptable` sets the internal `codepage` instance. This provides support
|
||||
for different language encodings.
|
||||
for different languages in XLS or text parsing.
|
||||
|
||||
`XLSX.set_fs` set `fs` instance (using `readFileSync` and `writeFileSync`). This
|
||||
provides NodeJS ESM support for `XLSX.readFile` and `XLSX.writeFile`.
|
||||
|
@ -69,8 +69,8 @@ XLSX and XLSM files are ZIP containers containing a series of XML files in
|
||||
accordance with the Open Packaging Conventions (OPC). The XLSM format, almost
|
||||
identical to XLSX, is used for files containing macros.
|
||||
|
||||
The format is standardized in ECMA-376 and later in ISO/IEC 29500. Excel does
|
||||
not follow the specification, and there are additional documents discussing how
|
||||
The format is standardized in `ECMA-376` and `ISO/IEC 29500`. Excel does not
|
||||
follow the specification, and there are additional documents discussing how
|
||||
Excel deviates from the specification.
|
||||
|
||||
### Excel 2.0-95 (BIFF2/BIFF3/BIFF4/BIFF5)
|
||||
@ -160,8 +160,8 @@ All versions of Works were limited to a single worksheet.
|
||||
Works for DOS 1.x - 3.x and Works for Windows 2.x extends the Lotus WKS format
|
||||
with additional record types.
|
||||
|
||||
Works for Windows 3.x - 5.x uses the same format and WKS extension. The BOF
|
||||
record has type `FF`
|
||||
Works for Windows 3.x - 5.x uses the same format and WKS extension. The `BOF`
|
||||
record has type `0xFF`
|
||||
|
||||
Works for Windows 6.x - 9.x use the XLR format. XLR is nearly identical to
|
||||
BIFF8 XLS: it uses the CFB container with a Workbook stream. Works 9 saves the
|
||||
@ -185,8 +185,8 @@ The writer currently exports a small range from the first worksheet.
|
||||
#### OpenDocument Spreadsheet (ODS/FODS)
|
||||
|
||||
ODS is an XML-in-ZIP format akin to XLSX while FODS is an XML format akin to
|
||||
SpreadsheetML. Both are detailed in the OASIS standard, but tools like LO/OO
|
||||
add undocumented extensions. The parsers and writers do not implement the full
|
||||
SpreadsheetML. Both are detailed in the OASIS standard, but LibreOffice adds
|
||||
undocumented extensions. The parsers and writers do not implement the full
|
||||
standard, instead focusing on parts necessary to extract and store raw data.
|
||||
|
||||
#### Uniform Office Spreadsheet (UOS1/2)
|
||||
|
@ -65,7 +65,7 @@ sudo npm i -g n
|
||||
sudo n 16
|
||||
```
|
||||
|
||||
3) follow <https://github.com/paul-nelson-baker/git-openssl-shellscript> to
|
||||
3) Follow <https://github.com/paul-nelson-baker/git-openssl-shellscript> to
|
||||
build and install a version of Git with proper SSL support:
|
||||
|
||||
```bash
|
||||
|
@ -10,8 +10,19 @@ Some of our original research is documented at <https://oss.sheetjs.com/notes/>
|
||||
The specifications list is non-exhaustive.
|
||||
|
||||
- Worksheet File Format (From Lotus) December 1984
|
||||
- Open Document Format for Office Applications Version 1.2 (29 September 2011)
|
||||
- ISO/IEC 29500:2012(E) "Information technology — Document description and processing languages — Office Open XML File Formats"
|
||||
- Open Document Format for Office Applications Version 1.3
|
||||
|
||||
:::info
|
||||
|
||||
The primary specifications for XLSX are:
|
||||
|
||||
- `ISO/IEC 29500` "Information technology — Document description and processing languages — Office Open XML File Formats"
|
||||
- `ECMA-376` "Office Open XML file formats"
|
||||
|
||||
As some editions of `ECMA-376` are identical to `ISO` specification editions,
|
||||
most of the public XLSX document community use the spec names interchangeably.
|
||||
|
||||
:::
|
||||
|
||||
## Open Specifications Promise
|
||||
|
||||
@ -29,7 +40,7 @@ to sue. The documentation that falls under the promise are listed below.
|
||||
- `MS-ODRAWXML`: Office Drawing Extensions to Office Open XML Structure
|
||||
- `MS-OE376`: Office Implementation Information for ECMA-376 Standards Support
|
||||
- `MS-OFFCRYPTO`: Office Document Cryptography Structure
|
||||
- `MS-OI29500`: Office Implementation Information for ISO/IEC 29500 Standards Support
|
||||
- `MS-OI29500`: Office Implementation Information for `ISO/IEC 29500` Standards Support
|
||||
- `MS-OLEDS`: Object Linking and Embedding (OLE) Data Structures
|
||||
- `MS-OLEPS`: Object Linking and Embedding (OLE) Property Set Data Structures
|
||||
- `MS-OODF3`: Office Implementation Information for ODF 1.2 Standards Support
|
||||
|
@ -7,7 +7,7 @@ exports.handler = function(event, context, callback) {
|
||||
if(event.requestContext.http.method == "GET") {
|
||||
/* make workbook */
|
||||
var wb = XLSX.read("S,h,e,e,t,J,S\n5,4,3,3,7,9,5", {type: "binary"});
|
||||
/* write to XLSX file in base64 encoding */
|
||||
/* write to XLSX file in Base64 encoding */
|
||||
var body = XLSX.write(wb, {type:"base64", bookType: "xlsx"});
|
||||
/* mark as attached file */
|
||||
var headers = { "Content-Disposition": 'attachment; filename="SheetJSLambda.xlsx"'};
|
||||
|
Loading…
Reference in New Issue
Block a user