@justybase/spreadsheet-tasks 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +20 -2
- package/dist/cjs/index.d.ts +61 -3
- package/dist/cjs/index.js +1043 -176
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1042 -176
- package/dist/esm/index.js.map +1 -1
- package/docs/API.md +32 -2
- package/package.json +2 -2
package/docs/API.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- [XlsbReader](#xlsbreader)
|
|
8
8
|
- [XlsxReader](#xlsxreader)
|
|
9
9
|
- [XlsxUpdater](#xlsxupdater)
|
|
10
|
+
- [XlsmUpdater](#xlsmupdater)
|
|
10
11
|
- [XlsbUpdater](#xlsbupdater)
|
|
11
12
|
- [Excel conversion](#excel-conversion)
|
|
12
13
|
- [ReaderFactory](#readerfactory)
|
|
@@ -244,8 +245,9 @@ new XlsxUpdater(filePath: string)
|
|
|
244
245
|
**Parameters:**
|
|
245
246
|
- `filePath` - Path to an existing `.xlsx` file
|
|
246
247
|
|
|
247
|
-
Throws if the file does not exist, is not a valid XLSX, or is an XLSB
|
|
248
|
-
|
|
248
|
+
Throws if the file does not exist, is not a valid XLSX package, or is an XLSB.
|
|
249
|
+
Macro-enabled `.xlsm` packages can use the explicit [XlsmUpdater](#xlsmupdater)
|
|
250
|
+
alias; unknown VBA members are preserved.
|
|
249
251
|
|
|
250
252
|
**Example:**
|
|
251
253
|
```typescript
|
|
@@ -299,10 +301,28 @@ updater.save('report_new.xlsx');
|
|
|
299
301
|
Writes the updated workbook to disk. When `outputPath` is omitted, the source
|
|
300
302
|
file is overwritten in place.
|
|
301
303
|
|
|
304
|
+
#### `replaceSheetDataStream(sheetName: string, rows: RowSource, options?: ReplaceSheetDataOptions): Promise<void>`
|
|
305
|
+
|
|
306
|
+
Replaces worksheet rows from a synchronous or asynchronous one-pass row source.
|
|
307
|
+
The row source is processed incrementally and is not collected into a complete
|
|
308
|
+
2D array. Use `saveStreaming()` to also avoid materialising the final ZIP buffer.
|
|
309
|
+
|
|
310
|
+
#### `saveStreaming(outputPath?: string): Promise<void>`
|
|
311
|
+
|
|
312
|
+
Writes the updated package through a temporary file and installs it atomically.
|
|
313
|
+
Staged worksheet parts are streamed; `save()` remains the simpler synchronous
|
|
314
|
+
buffering path.
|
|
315
|
+
|
|
302
316
|
#### `toBuffer(): Buffer`
|
|
303
317
|
|
|
304
318
|
Returns the updated workbook as an in-memory ZIP buffer.
|
|
305
319
|
|
|
320
|
+
## XlsmUpdater
|
|
321
|
+
|
|
322
|
+
`XlsmUpdater` is an explicit alias of `XlsxUpdater` for macro-enabled `.xlsm`
|
|
323
|
+
packages. It has the same API as `XlsxUpdater` and preserves VBA parts without
|
|
324
|
+
parsing or modifying them.
|
|
325
|
+
|
|
306
326
|
---
|
|
307
327
|
|
|
308
328
|
## XlsbUpdater
|
|
@@ -469,6 +489,16 @@ await reader.open('data.xlsb');
|
|
|
469
489
|
| `Date` | Date Serial Number |
|
|
470
490
|
| `null` / `undefined` | Empty Cell |
|
|
471
491
|
|
|
492
|
+
### `RowSource`
|
|
493
|
+
|
|
494
|
+
```typescript
|
|
495
|
+
type RowSource =
|
|
496
|
+
| Iterable<ReadonlyArray<CellValue>>
|
|
497
|
+
| AsyncIterable<ReadonlyArray<CellValue>>;
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Used by `replaceSheetDataStream()` in both updater classes.
|
|
501
|
+
|
|
472
502
|
### Sheet Name Restrictions
|
|
473
503
|
|
|
474
504
|
Sheet names have the following restrictions:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justybase/spreadsheet-tasks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "High-performance TypeScript library for reading and writing Excel files in XLSB and XLSX formats. XLSB is 3.3x faster to write and 2.3x faster to read than XLSX.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"test": "npm run typecheck && npm run test:smoke && npm run test:unit && npm run test:integration && npm run test:dist",
|
|
31
31
|
"test:smoke": "npx ts-node tests/smoke.test.ts",
|
|
32
|
-
"test:unit": "npx ts-node tests/unit/bigbuffer.test.ts && npx ts-node tests/unit/biff-reader-writer.test.ts && npx ts-node tests/unit/xlsb-writer.test.ts && npx ts-node tests/unit/excel-converter.test.ts",
|
|
32
|
+
"test:unit": "npx ts-node tests/unit/bigbuffer.test.ts && npx ts-node tests/unit/biff-reader-writer.test.ts && npx ts-node tests/unit/xlsb-writer.test.ts && npx ts-node tests/unit/excel-converter.test.ts && npx ts-node tests/unit/updater-streaming.test.ts",
|
|
33
33
|
"test:integration": "npx ts-node tests/integration/xlsb-writer.test.ts && npx ts-node tests/integration/xlsx-writer.test.ts && npx ts-node tests/integration/xlsx-updater.test.ts && npx ts-node tests/integration/xlsb-updater.test.ts",
|
|
34
34
|
"test:dist": "npm run build && npx ts-node tests/dist-surface.test.ts",
|
|
35
35
|
"test:excel-conversion": "npm run build && npx ts-node tests/excel-compat/conversion.ts",
|