xsheetjs/docbits/10_install.md
2017-09-24 19:40:09 -04:00

3.0 KiB

Installation

In the browser, just add a script tag:

<script lang="javascript" src="dist/xlsx.full.min.js"></script>
CDN Availability (click to show)
CDN URL
unpkg https://unpkg.com/xlsx/
jsDelivr https://jsdelivr.com/package/npm/xlsx
CDNjs http://cdnjs.com/libraries/xlsx

unpkg makes the latest version available at:

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

With npm:

$ npm install xlsx

With bower:

$ bower install js-xlsx

JS Ecosystem Demos

The demos directory includes sample projects for:

Frameworks and APIs

Bundlers and Tooling

Platforms and Integrations

Optional Modules

Optional features (click to show)

The node version automatically requires modules for additional features. Some of these modules are rather large in size and are only needed in special circumstances, so they do not ship with the core. For browser use, they must be included directly:

<!-- international support from js-codepage -->
<script src="dist/cpexcel.js"></script>

An appropriate version for each dependency is included in the dist/ directory.

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

Webpack and Browserify builds include optional modules by default. Webpack can be configured to remove support with resolve.alias:

  /* uncomment the lines below to remove support */
  resolve: {
    alias: { "./dist/cpexcel.js": "" } // <-- omit international support
  }

ECMAScript 5 Compatibility

Since the library uses functions 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:

<!-- add the shim first -->
<script type="text/javascript" src="shim.js"></script>
<!-- after the shim is referenced, add the library -->
<script type="text/javascript" src="xlsx.full.min.js"></script>