diff --git a/index.html b/index.html index 05b147af..53d3e2eb 100644 --- a/index.html +++ b/index.html @@ -250,35 +250,18 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! Installation

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 script tag:

+can be directly added to a page with a <script> tag:

<script lang="javascript" src="dist/xlsx.full.min.js"></script>
-
- CDN Availability (click to show) - - - - - - - - - - - - - - - - - - - - - -
CDNURL
unpkghttps://unpkg.com/xlsx/
jsDelivrhttps://jsdelivr.com/package/npm/xlsx
CDNjshttps://cdnjs.com/libraries/xlsx
-

For example, unpkg makes the latest version available at:

-
<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
-
+

Each standalone release script is available at https://cdn.sheetjs.com/. The +latest version uses the latest tag:

+
<!-- use the latest version -->
+<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
+

A specific release can be referenced by version:

+
<!-- use version 0.18.5 -->
+<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-0.18.5/package/dist/xlsx.full.min.js"></script>
+

For production use, scripts should be downloaded and added to a public folder +alongside other scripts.

+
Browser builds (click to show)

The complete single-file version is generated at dist/xlsx.full.min.js

@@ -289,22 +272,25 @@ can be directly added to a page with a script tag:

  • no support for XLSB / XLS / Lotus 1-2-3 / SpreadsheetML 2003 / Numbers
  • node stream utils removed
  • +

    These scripts are also available on the CDN:

    +
    <!-- use xlsx.mini.min.js from the latest version -->
    +<script lang="javascript" src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.mini.min.js"></script>

    With bower:

    $ 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:

    +a page with a script tag using type="module":

    <script type="module">
    -import { read, writeFileXLSX } from "./xlsx.mjs";
    +import { read, writeFileXLSX } from "https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs";
     
     /* load the codepage support library for extended support with older formats  */
    -import { set_cptable } from "./xlsx.mjs";
    -import * as cptable from './dist/cpexcel.full.mjs';
    +import { set_cptable } from "https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs";
    +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs';
     set_cptable(cptable);
     </script>
    -

    The npm package also exposes the module -with the module parameter, supported in Angular and other projects:

    +

    The NodeJS package also exposes the module with the module parameter, which is +supported in Angular and other projects:

    import { read, writeFileXLSX } from "xlsx";
     
     /* load the codepage support library for extended support with older formats  */
    @@ -312,16 +298,37 @@ with the module parameter, supported in Angular and other projects:
     import * as cptable from 'xlsx/dist/cpexcel.full.mjs';
     set_cptable(cptable);

    Deno

    -

    xlsx.mjs can be imported in Deno. It is available from unpkg:

    -
    // @deno-types="https://unpkg.com/xlsx/types/index.d.ts"
    -import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs';
    +

    xlsx.mjs can be imported in Deno:

    +
    // @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://unpkg.com/xlsx/dist/cpexcel.full.mjs';
    +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs';
     XLSX.set_cptable(cptable);

    NodeJS

    -

    With npm:

    -
    $ npm install xlsx
    +

    Tarballs are available on https://cdn.sheetjs.com.

    +

    https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz is a link to the latest +version and will refresh on each release.

    +

    Each individual version can be referenced using a similar URL pattern. +https://cdn.sheetjs.com/xlsx-0.18.6/xlsx-0.18.6.tgz is the URL for 0.18.6

    +

    For general stability, "vendoring" modules is the recommended approach:

    +
      +
    1. +

      Download the tarball (xlsx-<version>.tgz) for the desired version.

      +
    2. +
    3. +

      Create a vendor subdirectory at the root of your project and move the +tarball to that folder. Add it to your project repository.

      +
    4. +
    5. +

      Install the tarball using a package manager:

      +
    6. +
    +
    # 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:

    var XLSX = require("xlsx");

    The module also ships with xlsx.mjs for use with import:

    @@ -339,9 +346,9 @@ with the module parameter, supported in Angular and other projects: 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 -that is included in the npm package. It can be directly referenced with a -#include directive:

    +

    dist/xlsx.extendscript.js is an ExtendScript build for Photoshop and InDesign. +https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.extendscript.js is the +latest build. It can be directly referenced with a #include directive:

    #include "xlsx.extendscript.js"
     
    @@ -537,7 +544,7 @@ it will write to the local directory.

    })();

    For use in the web browser, assuming the snippet is saved to snippet.js, script tags should be used to include the axios and xlsx standalone builds:

    -
    <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
    +
    <script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
     <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
     <script src="snippet.js"></script>
    @@ -557,8 +564,8 @@ about the specific file formats involved.

  • angular and ionic
  • knockout
  • meteor
  • -
  • react and react-native
  • -
  • vue 2.x and weex
  • +
  • react, react-native, next
  • +
  • vue 2.x, weex, nuxt
  • XMLHttpRequest and fetch
  • nodejs server
  • databases and key/value stores
  • @@ -935,7 +942,7 @@ optional opts argument in more detail.

    generating a worksheet object. By default, it will generate a header row and one row per object in the array. The optional opts argument has settings to control the column order and header output.

    -

    "Array of Objects Input" describes the function and +

    "Array of Objects Input" describes the function and the optional opts argument in more detail.

    Examples

    "Zen of SheetJS" contains a detailed example "Get Data @@ -1000,8 +1007,8 @@ is missing or no options are specified, the default name Sheet1 is

    HTML TABLE element in a webpage (click to show)
    <!-- include the standalone script and shim.  this uses the UNPKG CDN -->
    -<script src="https://unpkg.com/xlsx/dist/shim.min.js"></script>
    -<script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
    +<script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/shim.min.js"></script>
    +<script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
     
     <!-- example table with id attribute -->
     <table id="tableau">
    @@ -1120,7 +1127,7 @@ a binary workbook and send it back for further processing:

    page.open('https://sheetjs.com/demos/table', function() { /* Load the browser script from the UNPKG CDN */ - page.includeJs("https://unpkg.com/xlsx/dist/xlsx.full.min.js", function() { + page.includeJs("https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js", function() { /* The code will return an XLSB file encoded as binary string */ var bin = page.evaluateJavaScript(code); @@ -1564,7 +1571,7 @@ any DOM element by setting the innerHTML:

    <body>
       <style>TABLE { border-collapse: collapse; } TD { border: 1px solid; }</style>
       <div id="tavolo"></div>
    -  <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
    +  <script src="https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"></script>
       <script type="text/javascript">
     (async() => {
       /* fetch and parse workbook -- see the fetch example for details */
    @@ -4662,6 +4669,12 @@ range limits will be silently truncated:

    1048576 +Numbers 12.0 (NUMBERS) +ALL1000000 +1000 +1000000 + + Excel 97-2004 (XLS BIFF8) IV65536 256