forked from sheetjs/docs.sheetjs.com
aoa_to_sheet cell objects
This commit is contained in:
parent
bb95be789f
commit
88d895ca29
@ -66,15 +66,9 @@ downloaded and manually uploaded to the project.
|
||||
|
||||
## RequireJS
|
||||
|
||||
After downloading the script, it can be referenced directly in `require` calls:
|
||||
:::caution
|
||||
|
||||
```js
|
||||
require(['./xlsx.full.min'], function(XLSX) {
|
||||
// ... use XLSX here
|
||||
});
|
||||
```
|
||||
|
||||
#### Aliases
|
||||
The standalone script must be aliased to the path `xlsx`.
|
||||
|
||||
The `requirejs.config` function can define aliases through the `paths` key:
|
||||
|
||||
@ -86,7 +80,9 @@ requirejs.config({
|
||||
});
|
||||
```
|
||||
|
||||
Once that is set, app code can freely require `xlsx`:
|
||||
:::
|
||||
|
||||
After configuring the alias, app code can freely require `xlsx`:
|
||||
|
||||
```js
|
||||
require(['xlsx'], function(XLSX) {
|
||||
|
@ -169,7 +169,7 @@ export async function getServerSideProps() {
|
||||
|
||||
### Demo
|
||||
|
||||
<details open><summary><b>Complete Example</b> (click to show)</summary>
|
||||
<details><summary><b>Complete Example</b> (click to show)</summary>
|
||||
|
||||
0) Disable NextJS telemetry:
|
||||
|
||||
@ -335,7 +335,6 @@ Through an override in `nuxt.config.js`, Nuxt Content will use custom parsers.
|
||||
Differences from a stock `create-nuxt-app` config are shown below:
|
||||
|
||||
```js
|
||||
// highlight-start
|
||||
import { readFile, utils } from 'xlsx';
|
||||
|
||||
// This will be called when the files change
|
||||
@ -345,12 +344,10 @@ const parseSheet = (file, { path }) => {
|
||||
const o = wb.SheetNames.map(name => ({ name, data: utils.sheet_to_json(wb.Sheets[name])}));
|
||||
return { data: o };
|
||||
}
|
||||
// highlight-end
|
||||
|
||||
export default {
|
||||
// ...
|
||||
|
||||
// highlight-start
|
||||
// content.extendParser allows us to hook into the parsing step
|
||||
content: {
|
||||
extendParser: {
|
||||
@ -361,7 +358,6 @@ export default {
|
||||
// can add other extensions like ".fods" as desired
|
||||
}
|
||||
},
|
||||
// highlight-end
|
||||
|
||||
// ...
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ run in the web browser, demos will include interactive examples.
|
||||
- [`Google Sheets API`](./gsheet)
|
||||
- [`ExtendScript for Adobe Apps`](./extendscript)
|
||||
- [`NetSuite SuiteScript`](./netsuite)
|
||||
- [`SalesForce Lightning Web Components`](./salesforce)
|
||||
- [`Salesforce Lightning Web Components`](./salesforce)
|
||||
- [`Excel JavaScript API`](./excelapi)
|
||||
- [`Headless Automation`](./headless)
|
||||
- [`Other JavaScript Engines`](./engines)
|
||||
|
@ -31,10 +31,15 @@ var ws = XLSX.utils.aoa_to_sheet(aoa, opts);
|
||||
```
|
||||
|
||||
`XLSX.utils.aoa_to_sheet` takes an array of arrays of JS values and returns a
|
||||
worksheet resembling the input data. Numbers, Booleans and Strings are stored
|
||||
as the corresponding styles. Dates are stored as date or numbers. Array holes
|
||||
and explicit `undefined` values are skipped. `null` values may be stubbed. All
|
||||
other values are stored as strings. The function takes an options argument:
|
||||
worksheet resembling the input data. Values are interpreted as follows:
|
||||
|
||||
- Numbers, Booleans and Strings are stored as the corresponding types.
|
||||
- Date objects are stored as Date cells or date codes (see `cellDates` option)
|
||||
- Array holes and explicit `undefined` values are skipped.
|
||||
- `null` values may be stubbed (see `sheetStubs` and `nullError` options)
|
||||
- Cell objects are used as-is.
|
||||
|
||||
The function takes an options argument:
|
||||
|
||||
| Option Name | Default | Description |
|
||||
| :---------- | :-----: | :--------------------------------------------------- |
|
||||
|
@ -48,7 +48,7 @@ const FeatureList = [
|
||||
description: (
|
||||
<>
|
||||
SheetJS runs everywhere: web browsers, servers, desktop apps, mobile
|
||||
apps, SalesForce and Photoshop plugins, even within Excel!
|
||||
apps, Salesforce and Photoshop plugins, even within Excel!
|
||||
</>
|
||||
),
|
||||
denouement: (
|
||||
|
Loading…
Reference in New Issue
Block a user