@simplysm/excel 13.0.41 → 13.0.43
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/README.md +11 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ pnpm add @simplysm/excel
|
|
|
49
49
|
| `ExcelVerticalAlign` | Vertical alignment (`"center" \| "top" \| "bottom"`) |
|
|
50
50
|
| `ExcelAddressPoint` | Cell coordinates (`{ r: number; c: number }`) |
|
|
51
51
|
| `ExcelAddressRangePoint` | Range coordinates (`{ s: ExcelAddressPoint; e: ExcelAddressPoint }`) |
|
|
52
|
+
| `ExcelXml` | Interface for internal XML data objects (`{ readonly data: unknown; cleanup(): void }`) |
|
|
52
53
|
|
|
53
54
|
## Usage
|
|
54
55
|
|
|
@@ -321,6 +322,9 @@ const records = [
|
|
|
321
322
|
// write() accepts Partial records and returns ExcelWorkbook, so resource management is required
|
|
322
323
|
await using wb = await wrapper.write("Users", records);
|
|
323
324
|
const bytes = await wb.getBytes();
|
|
325
|
+
|
|
326
|
+
// Exclude specific fields from the output
|
|
327
|
+
await using wb2 = await wrapper.write("Users", records, { excludes: ["email"] });
|
|
324
328
|
```
|
|
325
329
|
|
|
326
330
|
The `write()` method automatically applies the following formatting:
|
|
@@ -338,6 +342,9 @@ const records = await wrapper.read(bytes);
|
|
|
338
342
|
// Specify worksheet name or index
|
|
339
343
|
const records2 = await wrapper.read(bytes, "Users");
|
|
340
344
|
const records3 = await wrapper.read(bytes, 0);
|
|
345
|
+
|
|
346
|
+
// Exclude specific fields when reading
|
|
347
|
+
const records4 = await wrapper.read(bytes, 0, { excludes: ["email"] });
|
|
341
348
|
```
|
|
342
349
|
|
|
343
350
|
Behavior of the `read()` method:
|
|
@@ -421,10 +428,11 @@ Behavior of the `read()` method:
|
|
|
421
428
|
|
|
422
429
|
| Member | Type / Return Type | Description |
|
|
423
430
|
|--------|-----------|------|
|
|
431
|
+
| `constructor(arg?)` | — | Create a new workbook (no arg), or open an existing file from `Uint8Array` or `Blob` |
|
|
424
432
|
| `getWorksheet(nameOrIndex)` | `Promise<ExcelWorksheet>` | Get worksheet (name or 0-based index) |
|
|
425
433
|
| `createWorksheet(name)` | `Promise<ExcelWorksheet>` | Create new worksheet |
|
|
426
434
|
| `getWorksheetNames()` | `Promise<string[]>` | Get all worksheet names |
|
|
427
|
-
| `getBytes()` | `Promise<
|
|
435
|
+
| `getBytes()` | `Promise<Uint8Array>` | Export as Uint8Array |
|
|
428
436
|
| `getBlob()` | `Promise<Blob>` | Export as Blob |
|
|
429
437
|
| `close()` | `Promise<void>` | Release resources |
|
|
430
438
|
|
|
@@ -433,8 +441,8 @@ Behavior of the `read()` method:
|
|
|
433
441
|
| Member | Type / Return Type | Description |
|
|
434
442
|
|--------|-----------|------|
|
|
435
443
|
| `constructor(schema)` | — | Create wrapper with a Zod schema (use `.describe()` on fields for Excel header names; defaults to field key) |
|
|
436
|
-
| `read(file, wsNameOrIndex?)` | `Promise<z.infer<TSchema>[]>` | Read records from Excel file (Uint8Array or Blob); defaults to first worksheet |
|
|
437
|
-
| `write(wsName, records)` | `Promise<ExcelWorkbook>` | Write partial records to a new workbook; caller must manage the returned workbook's lifecycle |
|
|
444
|
+
| `read(file, wsNameOrIndex?, options?)` | `Promise<z.infer<TSchema>[]>` | Read records from Excel file (`Uint8Array` or `Blob`); defaults to first worksheet. `options.excludes` omits specific fields. |
|
|
445
|
+
| `write(wsName, records, options?)` | `Promise<ExcelWorkbook>` | Write partial records to a new workbook; caller must manage the returned workbook's lifecycle. `options.excludes` omits specific fields. |
|
|
438
446
|
|
|
439
447
|
## Caveats
|
|
440
448
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/excel",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.43",
|
|
4
4
|
"description": "Excel 파일 처리 라이브러리",
|
|
5
5
|
"author": "김석래",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"mime": "^4.1.0",
|
|
22
22
|
"zod": "^4.3.6",
|
|
23
|
-
"@simplysm/core-common": "13.0.
|
|
23
|
+
"@simplysm/core-common": "13.0.43"
|
|
24
24
|
}
|
|
25
25
|
}
|