https://github.com/simon5057/xlsx-preview
Preview the .xlsx in the browser, convert to HTML with styles.
https://github.com/simon5057/xlsx-preview
html preview xlsx xlsx-preview
Last synced: 6 months ago
JSON representation
Preview the .xlsx in the browser, convert to HTML with styles.
- Host: GitHub
- URL: https://github.com/simon5057/xlsx-preview
- Owner: simon5057
- License: mit
- Created: 2021-10-15T09:55:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-17T08:30:24.000Z (over 3 years ago)
- Last Synced: 2025-09-27T05:53:03.316Z (10 months ago)
- Topics: html, preview, xlsx, xlsx-preview
- Language: TypeScript
- Homepage: https://simon5057.github.io/xlsx-preview/
- Size: 1.35 MB
- Stars: 28
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## XlsxPreview
Preview the .xlsx in the browser, convert to HTML with styles.
The dependencies of this package is [exceljs](https://github.com/exceljs/exceljs), it build the pretty preview by exceljs.
And it can run in a Worker.
### Demo
Jump to the [demo page](./demo.html)
### Installation
```
npm install xlsx-preview
```
or
```
yarn add xlsx-preview
```
### Importing
#### CommonJS
``` js
const xlsxPreview = require('xlsx-preview');
```
#### ESModule
``` js
import xlsxPreview from 'xlsx-preview';
```
#### Browserify
Before import xlsxPreview.js on browser, you need import excel.js first.
``` html
```
### Usage
``` js
// ...
const result = await xlsxPreview.xlsx2Html(data, options);
```
See [data](#data)
See [options](#options)
#### data
The `data` can be one of the types, ArrayBuffer, Blob, or File.
#### options
The `options` is optional.
``` ts
export interface XlsxOptions {
output?: "string" | "arrayBuffer";
separateSheets: boolean;
minimumRows: number;
minimumCols: number;
}
```
- `options.output`: default `"string"`, set the output format, string or ArrayBuffer.
- `separateSheets`: default `false`, whether the worksheets needs to be separated.
- If `separateSheets: true`, the `result` will be an Array.
- `minimumRows`: default `20`, Regardless of whether the worksheet has enough rows, the minimum number of rows generated.
- `minimumCols`: default `16`, Regardless of whether the worksheet has enough cols, the minimum number of cols generated.