diff --git a/README.md b/README.md index e886bf9..bd31722 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,11 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! - [Getting Started](#getting-started) * [Installation](#installation) + + [Standalone Browser Scripts](#standalone-browser-scripts) + + [ECMAScript Modules](#ecmascript-modules) + + [Deno](#deno) + + [NodeJS](#nodejs) + + [Photoshop and InDesign](#photoshop-and-indesign) * [Usage](#usage) * [The Zen of SheetJS](#the-zen-of-sheetjs) * [JS Ecosystem Demos](#js-ecosystem-demos) @@ -116,34 +121,26 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! ### Installation -**Standalone Browser Scripts** +#### Standalone Browser Scripts -The complete browser standalone build is saved to `dist/xlsx.full.min.js` and -can be directly added to a page with a ` + + ``` -Each standalone release script is available at . The -latest version uses the `latest` tag: +The `latest` tag references the latest version and updates with each release: ```html ``` -A specific release can be referenced by version: - -```html - - -``` - -For production use, scripts should be downloaded and added to a public folder -alongside other scripts. - - +**For production use, scripts should be downloaded and added to a public folder +alongside other scripts.**
Browser builds (click to show) @@ -160,130 +157,20 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: These scripts are also available on the CDN: ```html - - + + ```
-With [bower](https://bower.io/search/?q=js-xlsx): +[Bower](https://bower.io/search/?q=js-xlsx) will pull the entire repo: ```bash $ bower install js-xlsx ``` -**ECMAScript Modules** - -The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to -a page with a `script` tag using `type="module"`: - -```html - -``` - -The NodeJS package also exposes the module with the `module` parameter, which is -supported in Angular and other projects: - -```ts -import { read, writeFileXLSX } from "xlsx"; - -/* load the codepage support library for extended support with older formats */ -import { set_cptable } from "xlsx"; -import * as cptable from 'xlsx/dist/cpexcel.full.mjs'; -set_cptable(cptable); -``` - -**Deno** - -`xlsx.mjs` can be imported in Deno: - -```ts -// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" -import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; - -/* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; -XLSX.set_cptable(cptable); -``` - -**NodeJS** - -Tarballs are available on . - - is a link to the latest -version and will refresh on each release. - -Each individual version can be referenced using a similar URL pattern. - is the URL for `0.18.6` - -Tarballs can be directly installed using a package manager: - -```bash -$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm -$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm -$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn -``` - -For general stability, "vendoring" modules is the recommended approach: - -1) Download the tarball (`xlsx-.tgz`) for the desired version. - -2) Create a `vendor` subdirectory at the root of your project and move the - tarball to that folder. Add it to your project repository. - -3) Install the tarball using a package manager: - -```bash -# note : replace $VERSION with the actual version (e.g. latest or 0.18.6) -$ npm install --save file:vendor/xlsx-$VERSION.tgz # npm -$ pnpm install --save file:vendor/xlsx-$VERSION.tgz # pnpm -$ yarn add file:vendor/xlsx-$VERSION.tgz # yarn -``` - -The package will be installed and accessible as `xlsx`. - -By default, the module supports `require`: - -```js -var XLSX = require("xlsx"); -``` - -The module also ships with `xlsx.mjs` for use with `import`: - -```js -import * as XLSX from 'xlsx/xlsx.mjs'; - -/* load 'fs' for readFile and writeFile support */ -import * as fs from 'fs'; -XLSX.set_fs(fs); - -/* load 'stream' for stream support */ -import { Readable } from 'stream'; -XLSX.stream.set_readable(Readable); - -/* load the codepage support library for extended support with older formats */ -import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; -XLSX.set_cptable(cpexcel); -``` - -**Photoshop and InDesign** - -`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. - is the -latest build. It can be directly referenced with a `#include` directive: - -```extendscript -#include "xlsx.extendscript.js" -``` - +Bower will place the standalone scripts in `bower_components/js-xlsx/dist/`
Internet Explorer and ECMAScript 3 Compatibility (click to show) @@ -301,12 +188,147 @@ To use the shim, add the shim before the script tag that loads `xlsx.js`: ``` +Due to SSL certificate compatibility issues, it is highly recommended to save +the Standalone and Shim scripts from and add to a +public directory in the site. + The script also includes `IE_LoadFile` and `IE_SaveFile` for loading and saving files in Internet Explorer versions 6-9. The `xlsx.extendscript.js` script bundles the shim in a format suitable for Photoshop and other Adobe products.
+ +#### ECMAScript Modules + +_Browser ESM_ + +The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to +a page with a `script` tag using `type="module"`: + +```html + +``` + +_Frameworks (Angular, VueJS, React) and Bundlers (webpack, etc)_ + +The NodeJS package is readily installed from the tarballs: + +```bash +$ npm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn +``` + +Once installed, the library can be imported under the name `xlsx`: + +```ts +import { read, writeFileXLSX } from "xlsx"; + +/* load the codepage support library for extended support with older formats */ +import { set_cptable } from "xlsx"; +import * as cptable from 'xlsx/dist/cpexcel.full.mjs'; +set_cptable(cptable); +``` + +#### Deno + +`xlsx.mjs` can be imported in Deno: + +```ts +// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.6/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/xlsx.mjs'; + +/* load the codepage support library for extended support with older formats */ +import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cptable); +``` + +#### NodeJS + +Tarballs are available on . + +Each individual version can be referenced using a similar URL pattern. + is the URL for `0.18.6` + + is a link to the latest +version and will refresh on each release. + +_Installation_ + +Tarballs can be directly installed using a package manager: + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn +``` + +For general stability, "vendoring" modules is the recommended approach: + +1) Download the tarball (`xlsx-0.18.6.tgz`) for the desired version. The current + version is available at + +2) Create a `vendor` subdirectory at the root of your project and move the + tarball to that folder. Add it to your project repository. + +3) Install the tarball using a package manager: + +```bash +$ npm install --save file:vendor/xlsx-0.18.6.tgz # npm +$ pnpm install --save file:vendor/xlsx-0.18.6.tgz # pnpm +$ yarn add file:vendor/xlsx-0.18.6.tgz # yarn +``` + +The package will be installed and accessible as `xlsx`. + +_Usage_ + +By default, the module supports `require` and it will automatically add support +for streams and filesystem access: + +```js +var XLSX = require("xlsx"); +``` + +The module also ships with `xlsx.mjs` for use with `import`. The `mjs` version +does not automatically load native node modules: + +```js +import * as XLSX from 'xlsx/xlsx.mjs'; + +/* load 'fs' for readFile and writeFile support */ +import * as fs from 'fs'; +XLSX.set_fs(fs); + +/* load 'stream' for stream support */ +import { Readable } from 'stream'; +XLSX.stream.set_readable(Readable); + +/* load the codepage support library for extended support with older formats */ +import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); +``` + +#### Photoshop and InDesign + +`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. + is the +current version. After downloading the script, it can be directly referenced +with a `#include` directive: + +```extendscript +#include "xlsx.extendscript.js" +``` + + ### Usage Most scenarios involving spreadsheets and data can be broken into 5 parts: diff --git a/docbits/10_install.md b/docbits/10_install.md index 2ab2174..6d63cf5 100644 --- a/docbits/10_install.md +++ b/docbits/10_install.md @@ -2,34 +2,26 @@ ### Installation -**Standalone Browser Scripts** +#### Standalone Browser Scripts -The complete browser standalone build is saved to `dist/xlsx.full.min.js` and -can be directly added to a page with a ` + + ``` -Each standalone release script is available at . The -latest version uses the `latest` tag: +The `latest` tag references the latest version and updates with each release: ```html ``` -A specific release can be referenced by version: - -```html - - -``` - -For production use, scripts should be downloaded and added to a public folder -alongside other scripts. - - +**For production use, scripts should be downloaded and added to a public folder +alongside other scripts.**
Browser builds (click to show) @@ -46,130 +38,20 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: These scripts are also available on the CDN: ```html - - + + ```
-With [bower](https://bower.io/search/?q=js-xlsx): +[Bower](https://bower.io/search/?q=js-xlsx) will pull the entire repo: ```bash $ bower install js-xlsx ``` -**ECMAScript Modules** - -The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to -a page with a `script` tag using `type="module"`: - -```html - -``` - -The NodeJS package also exposes the module with the `module` parameter, which is -supported in Angular and other projects: - -```ts -import { read, writeFileXLSX } from "xlsx"; - -/* load the codepage support library for extended support with older formats */ -import { set_cptable } from "xlsx"; -import * as cptable from 'xlsx/dist/cpexcel.full.mjs'; -set_cptable(cptable); -``` - -**Deno** - -`xlsx.mjs` can be imported in Deno: - -```ts -// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" -import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; - -/* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; -XLSX.set_cptable(cptable); -``` - -**NodeJS** - -Tarballs are available on . - - is a link to the latest -version and will refresh on each release. - -Each individual version can be referenced using a similar URL pattern. - is the URL for `0.18.6` - -Tarballs can be directly installed using a package manager: - -```bash -$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm -$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm -$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn -``` - -For general stability, "vendoring" modules is the recommended approach: - -1) Download the tarball (`xlsx-.tgz`) for the desired version. - -2) Create a `vendor` subdirectory at the root of your project and move the - tarball to that folder. Add it to your project repository. - -3) Install the tarball using a package manager: - -```bash -# note : replace $VERSION with the actual version (e.g. latest or 0.18.6) -$ npm install --save file:vendor/xlsx-$VERSION.tgz # npm -$ pnpm install --save file:vendor/xlsx-$VERSION.tgz # pnpm -$ yarn add file:vendor/xlsx-$VERSION.tgz # yarn -``` - -The package will be installed and accessible as `xlsx`. - -By default, the module supports `require`: - -```js -var XLSX = require("xlsx"); -``` - -The module also ships with `xlsx.mjs` for use with `import`: - -```js -import * as XLSX from 'xlsx/xlsx.mjs'; - -/* load 'fs' for readFile and writeFile support */ -import * as fs from 'fs'; -XLSX.set_fs(fs); - -/* load 'stream' for stream support */ -import { Readable } from 'stream'; -XLSX.stream.set_readable(Readable); - -/* load the codepage support library for extended support with older formats */ -import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; -XLSX.set_cptable(cpexcel); -``` - -**Photoshop and InDesign** - -`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. - is the -latest build. It can be directly referenced with a `#include` directive: - -```extendscript -#include "xlsx.extendscript.js" -``` - +Bower will place the standalone scripts in `bower_components/js-xlsx/dist/`
Internet Explorer and ECMAScript 3 Compatibility (click to show) @@ -187,9 +69,144 @@ To use the shim, add the shim before the script tag that loads `xlsx.js`: ``` +Due to SSL certificate compatibility issues, it is highly recommended to save +the Standalone and Shim scripts from and add to a +public directory in the site. + The script also includes `IE_LoadFile` and `IE_SaveFile` for loading and saving files in Internet Explorer versions 6-9. The `xlsx.extendscript.js` script bundles the shim in a format suitable for Photoshop and other Adobe products.
+ +#### ECMAScript Modules + +_Browser ESM_ + +The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to +a page with a `script` tag using `type="module"`: + +```html + +``` + +_Frameworks (Angular, VueJS, React) and Bundlers (webpack, etc)_ + +The NodeJS package is readily installed from the tarballs: + +```bash +$ npm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn +``` + +Once installed, the library can be imported under the name `xlsx`: + +```ts +import { read, writeFileXLSX } from "xlsx"; + +/* load the codepage support library for extended support with older formats */ +import { set_cptable } from "xlsx"; +import * as cptable from 'xlsx/dist/cpexcel.full.mjs'; +set_cptable(cptable); +``` + +#### Deno + +`xlsx.mjs` can be imported in Deno: + +```ts +// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.6/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/xlsx.mjs'; + +/* load the codepage support library for extended support with older formats */ +import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cptable); +``` + +#### NodeJS + +Tarballs are available on . + +Each individual version can be referenced using a similar URL pattern. + is the URL for `0.18.6` + + is a link to the latest +version and will refresh on each release. + +_Installation_ + +Tarballs can be directly installed using a package manager: + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn +``` + +For general stability, "vendoring" modules is the recommended approach: + +1) Download the tarball (`xlsx-0.18.6.tgz`) for the desired version. The current + version is available at + +2) Create a `vendor` subdirectory at the root of your project and move the + tarball to that folder. Add it to your project repository. + +3) Install the tarball using a package manager: + +```bash +$ npm install --save file:vendor/xlsx-0.18.6.tgz # npm +$ pnpm install --save file:vendor/xlsx-0.18.6.tgz # pnpm +$ yarn add file:vendor/xlsx-0.18.6.tgz # yarn +``` + +The package will be installed and accessible as `xlsx`. + +_Usage_ + +By default, the module supports `require` and it will automatically add support +for streams and filesystem access: + +```js +var XLSX = require("xlsx"); +``` + +The module also ships with `xlsx.mjs` for use with `import`. The `mjs` version +does not automatically load native node modules: + +```js +import * as XLSX from 'xlsx/xlsx.mjs'; + +/* load 'fs' for readFile and writeFile support */ +import * as fs from 'fs'; +XLSX.set_fs(fs); + +/* load 'stream' for stream support */ +import { Readable } from 'stream'; +XLSX.stream.set_readable(Readable); + +/* load the codepage support library for extended support with older formats */ +import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cpexcel); +``` + +#### Photoshop and InDesign + +`dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. + is the +current version. After downloading the script, it can be directly referenced +with a `#include` directive: + +```extendscript +#include "xlsx.extendscript.js" +``` + + diff --git a/index.html b/index.html index e114888..02346f1 100644 --- a/index.html +++ b/index.html @@ -6,19 +6,25 @@ SheetJS Live Demo @@ -33,28 +39,32 @@ Output Format:
-
Drop a spreadsheet file here to see sheet data
- ... or click here to select a file + + + Drop a spreadsheet file anywhere in the page to see sheet data
Advanced Demo Options: -Use Web Workers: (when available) +Use Web Workers when available: +Always use UTF8 for CSV / text:

 
+
+ +

Drop a spreadsheet file here to see sheet data

+

- - - - + + + + ``` -Each standalone release script is available at . The -latest version uses the `latest` tag: +The `latest` tag references the latest version and updates with each release: ```html ``` -A specific release can be referenced by version: - -```html - - -``` - -For production use, scripts should be downloaded and added to a public folder -alongside other scripts. - +**For production use, scripts should be downloaded and added to a public folder +alongside other scripts.** The complete single-file version is generated at `dist/xlsx.full.min.js` @@ -154,36 +152,73 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: These scripts are also available on the CDN: ```html - - + + ``` -With [bower](https://bower.io/search/?q=js-xlsx): +[Bower](https://bower.io/search/?q=js-xlsx) will pull the entire repo: ```bash $ bower install js-xlsx ``` -**ECMAScript Modules** +Bower will place the standalone scripts in `bower_components/js-xlsx/dist/` + + +For broad compatibility with JavaScript engines, the library is written using +ECMAScript 3 language dialect as well as some ES5 features like `Array#forEach`. +Older browsers require shims to provide missing functions. + +To use the shim, add the shim before the script tag that loads `xlsx.js`: + +```html + + + + +``` + +Due to SSL certificate compatibility issues, it is highly recommended to save +the Standalone and Shim scripts from and add to a +public directory in the site. + +The script also includes `IE_LoadFile` and `IE_SaveFile` for loading and saving +files in Internet Explorer versions 6-9. The `xlsx.extendscript.js` script +bundles the shim in a format suitable for Photoshop and other Adobe products. + + + +#### ECMAScript Modules + +_Browser ESM_ The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to a page with a `script` tag using `type="module"`: ```html ``` -The NodeJS package also exposes the module with the `module` parameter, which is -supported in Angular and other projects: +_Frameworks (Angular, VueJS, React) and Bundlers (webpack, etc)_ + +The NodeJS package is readily installed from the tarballs: + +```bash +$ npm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add --save https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn +``` + +Once installed, the library can be imported under the name `xlsx`: ```ts import { read, writeFileXLSX } from "xlsx"; @@ -194,40 +229,43 @@ import * as cptable from 'xlsx/dist/cpexcel.full.mjs'; set_cptable(cptable); ``` -**Deno** +#### Deno `xlsx.mjs` can be imported in Deno: ```ts -// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" -import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; +// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.6/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; +import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.6/package/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` -**NodeJS** +#### NodeJS Tarballs are available on . - is a link to the latest -version and will refresh on each release. - Each individual version can be referenced using a similar URL pattern. is the URL for `0.18.6` + is a link to the latest +version and will refresh on each release. + +_Installation_ + Tarballs can be directly installed using a package manager: ```bash -$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # npm -$ pnpm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # pnpm -$ yarn add https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz # yarn +$ npm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # npm +$ pnpm install https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # pnpm +$ yarn add https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz # yarn ``` For general stability, "vendoring" modules is the recommended approach: -1) Download the tarball (`xlsx-.tgz`) for the desired version. +1) Download the tarball (`xlsx-0.18.6.tgz`) for the desired version. The current + version is available at 2) Create a `vendor` subdirectory at the root of your project and move the tarball to that folder. Add it to your project repository. @@ -235,21 +273,24 @@ For general stability, "vendoring" modules is the recommended approach: 3) Install the tarball using a package manager: ```bash -# note : replace $VERSION with the actual version (e.g. latest or 0.18.6) -$ npm install --save file:vendor/xlsx-$VERSION.tgz # npm -$ pnpm install --save file:vendor/xlsx-$VERSION.tgz # pnpm -$ yarn add file:vendor/xlsx-$VERSION.tgz # yarn +$ npm install --save file:vendor/xlsx-0.18.6.tgz # npm +$ pnpm install --save file:vendor/xlsx-0.18.6.tgz # pnpm +$ yarn add file:vendor/xlsx-0.18.6.tgz # yarn ``` The package will be installed and accessible as `xlsx`. -By default, the module supports `require`: +_Usage_ + +By default, the module supports `require` and it will automatically add support +for streams and filesystem access: ```js var XLSX = require("xlsx"); ``` -The module also ships with `xlsx.mjs` for use with `import`: +The module also ships with `xlsx.mjs` for use with `import`. The `mjs` version +does not automatically load native node modules: ```js import * as XLSX from 'xlsx/xlsx.mjs'; @@ -267,36 +308,18 @@ import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs'; XLSX.set_cptable(cpexcel); ``` -**Photoshop and InDesign** +#### Photoshop and InDesign `dist/xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. - is the -latest build. It can be directly referenced with a `#include` directive: + is the +current version. After downloading the script, it can be directly referenced +with a `#include` directive: ```extendscript #include "xlsx.extendscript.js" ``` - -For broad compatibility with JavaScript engines, the library is written using -ECMAScript 3 language dialect as well as some ES5 features like `Array#forEach`. -Older browsers require shims to provide missing functions. - -To use the shim, add the shim before the script tag that loads `xlsx.js`: - -```html - - - - -``` - -The script also includes `IE_LoadFile` and `IE_SaveFile` for loading and saving -files in Internet Explorer versions 6-9. The `xlsx.extendscript.js` script -bundles the shim in a format suitable for Photoshop and other Adobe products. - - ### Usage Most scenarios involving spreadsheets and data can be broken into 5 parts: diff --git a/misc/docs/SUMMARY.md b/misc/docs/SUMMARY.md index 271c9ce..7fed58c 100644 --- a/misc/docs/SUMMARY.md +++ b/misc/docs/SUMMARY.md @@ -3,6 +3,11 @@ - [xlsx](README.md#sheetjs-js-xlsx) - [Getting Started](README.md#getting-started) * [Installation](README.md#installation) + + [Standalone Browser Scripts](README.md#standalone-browser-scripts) + + [ECMAScript Modules](README.md#ecmascript-modules) + + [Deno](README.md#deno) + + [NodeJS](README.md#nodejs) + + [Photoshop and InDesign](README.md#photoshop-and-indesign) * [Usage](README.md#usage) * [The Zen of SheetJS](README.md#the-zen-of-sheetjs) * [JS Ecosystem Demos](README.md#js-ecosystem-demos) diff --git a/packages/xlsx-cli/index.js b/packages/xlsx-cli/index.js index b9c0aeb..d64852e 100644 --- a/packages/xlsx-cli/index.js +++ b/packages/xlsx-cli/index.js @@ -32,6 +32,7 @@ function run() { .option('-6, --xlml', 'emit SSML to or .xls (2003 XML)') .option('-T, --fods', 'emit FODS to or .fods (Flat ODS)') .option('--wk3', 'emit WK3 to or .txt (Lotus WK3)') + .option('--numbers', 'emit NUMBERS to or .numbers') .option('-S, --formulae', 'emit list of values and formulae') .option('-j, --json', 'emit formatted JSON (all fields text)') @@ -75,6 +76,7 @@ function run() { ['xls', 'xls', 'xls'], ['xla', 'xla', 'xla'], ['biff5', 'biff5', 'xls'], + ['numbers', 'numbers', 'numbers'], ['ods', 'ods', 'ods'], ['fods', 'fods', 'fods'], ['wk3', 'wk3', 'wk3'] @@ -178,6 +180,10 @@ function run() { workbook_formats.forEach(function (m) { if (program[m[0]] || isfmt(m[0])) { wopts.bookType = m[1]; + if (wopts.bookType == "numbers") try { + var XLSX_ZAHL = require("xlsx/dist/xlsx.zahl"); + wopts.numbers = XLSX_ZAHL; + } catch(e) {} if (wb) X.writeFile(wb, program.output || sheetname || ((filename || "") + "." + m[2]), wopts); process.exit(0); } diff --git a/packages/xlsx-cli/package.json b/packages/xlsx-cli/package.json index bc8249f..b624024 100644 --- a/packages/xlsx-cli/package.json +++ b/packages/xlsx-cli/package.json @@ -1,6 +1,6 @@ { "name": "xlsx-cli", - "version": "1.1.2", + "version": "1.1.3", "author": "sheetjs", "description": "Command-line interface for SheetJS", "keywords": [ @@ -24,7 +24,7 @@ "dependencies": { "commander": "~2.17.1", "exit-on-epipe": "~1.0.1", - "xlsx": "latest" + "xlsx": "https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz" }, "devDependencies": { }, diff --git a/xlsxworker.flow.js b/xlsxworker.flow.js index c2c1a5a..1d28088 100644 --- a/xlsxworker.flow.js +++ b/xlsxworker.flow.js @@ -10,7 +10,7 @@ importScripts('xlsx.js'); onmessage = function (evt) { var v; try { - v = XLSX.read(evt.data.d, {type: evt.data.b}); + v = XLSX.read(evt.data.d, {type: evt.data.b, codepage: evt.data.c}); /*::self.*/postMessage({t:"xlsx", d:JSON.stringify(v)}); } catch(e) { /*::self.*/postMessage({t:"e",d:e.stack||e}); } }; diff --git a/xlsxworker.js b/xlsxworker.js index 8a13f0b..888cc5f 100644 --- a/xlsxworker.js +++ b/xlsxworker.js @@ -8,7 +8,7 @@ postMessage({t:"ready"}); onmessage = function (evt) { var v; try { - v = XLSX.read(evt.data.d, {type: evt.data.b}); + v = XLSX.read(evt.data.d, {type: evt.data.b, codepage: evt.data.c}); postMessage({t:"xlsx", d:JSON.stringify(v)}); } catch(e) { postMessage({t:"e",d:e.stack||e}); } };