2017-03-20 09:02:25 +00:00
|
|
|
## Installation
|
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
In the browser, just add a script tag:
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
```html
|
|
|
|
<script lang="javascript" src="dist/xlsx.full.min.js"></script>
|
2017-03-20 09:02:25 +00:00
|
|
|
```
|
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
With [npm](https://www.npmjs.org/package/xlsx):
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-05-09 18:07:57 +00:00
|
|
|
```bash
|
|
|
|
$ npm install xlsx
|
2017-03-20 09:02:25 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
With [bower](http://bower.io/search/?q=js-xlsx):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ bower install js-xlsx
|
|
|
|
```
|
|
|
|
|
|
|
|
CDNjs automatically pulls the latest version and makes all versions available at
|
|
|
|
<http://cdnjs.com/libraries/xlsx>
|
|
|
|
|
|
|
|
### JS Ecosystem Demos
|
|
|
|
|
|
|
|
The `demos` directory includes sample projects for:
|
|
|
|
|
2017-09-05 05:26:50 +00:00
|
|
|
**JS Frameworks and APIs**
|
2017-06-24 06:51:37 +00:00
|
|
|
- [`angular 1.x`](demos/angular/)
|
|
|
|
- [`angular 2.x / 4.x`](demos/angular2/)
|
2017-05-24 22:52:35 +00:00
|
|
|
- [`meteor`](demos/meteor/)
|
2017-09-05 05:26:50 +00:00
|
|
|
- [`vue 2.x`](demos/vue/)
|
|
|
|
- [`XMLHttpRequest and fetch`](demos/xhr/)
|
2017-08-10 23:46:34 +00:00
|
|
|
|
|
|
|
**JS Bundlers and Tooling**
|
|
|
|
- [`browserify`](demos/browserify/)
|
2017-03-23 17:11:31 +00:00
|
|
|
- [`requirejs`](demos/requirejs/)
|
2017-06-08 06:19:11 +00:00
|
|
|
- [`rollup`](demos/rollup/)
|
2017-03-23 17:11:31 +00:00
|
|
|
- [`systemjs`](demos/systemjs/)
|
2017-09-05 05:26:50 +00:00
|
|
|
- [`webpack 2.x`](demos/webpack/)
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-08-10 23:46:34 +00:00
|
|
|
**JS Platforms and Integrations**
|
|
|
|
- [`Adobe ExtendScript`](demos/extendscript/)
|
2017-08-19 23:06:34 +00:00
|
|
|
- [`Headless Browsers`](demos/headless/)
|
2017-08-10 23:46:34 +00:00
|
|
|
- [`canvas-datagrid`](demos/datagrid/)
|
2017-09-05 05:26:50 +00:00
|
|
|
- [`Swift JSC and other engines`](demos/altjs/)
|
2017-08-10 23:46:34 +00:00
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
### Optional Modules
|
|
|
|
|
2017-05-24 22:52:35 +00:00
|
|
|
<details>
|
|
|
|
<summary><b>Optional features</b> (click to show)</summary>
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
```html
|
|
|
|
<!-- 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`:
|
|
|
|
|
|
|
|
```js
|
|
|
|
/* uncomment the lines below to remove support */
|
|
|
|
resolve: {
|
|
|
|
alias: { "./dist/cpexcel.js": "" } // <-- omit international support
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-05-24 22:52:35 +00:00
|
|
|
</details>
|
2017-03-20 09:02:25 +00:00
|
|
|
|
|
|
|
### ECMAScript 5 Compatibility
|
|
|
|
|
|
|
|
Since xlsx.js uses ES5 functions like `Array#forEach`, older browsers require
|
|
|
|
[Polyfills](http://git.io/QVh77g). This repo and the gh-pages branch include
|
|
|
|
[a shim](https://github.com/SheetJS/js-xlsx/blob/master/shim.js)
|
|
|
|
|
|
|
|
To use the shim, add the shim before the script tag that loads xlsx.js:
|
|
|
|
|
|
|
|
```html
|
|
|
|
<script type="text/javascript" src="/path/to/shim.js"></script>
|
|
|
|
```
|
|
|
|
|