@simplysm/excel 13.0.72 → 13.0.75
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 +55 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
# @simplysm/excel
|
|
2
2
|
|
|
3
|
-
Excel file processing library
|
|
3
|
+
Excel file processing library for reading, writing, and manipulating `.xlsx` files.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
```bash
|
|
7
8
|
pnpm add @simplysm/excel
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ExcelWorkbook } from "@simplysm/excel";
|
|
15
|
+
|
|
16
|
+
// Read an existing file
|
|
17
|
+
const bytes: Uint8Array = /* file bytes */;
|
|
18
|
+
await using wb = new ExcelWorkbook(bytes);
|
|
19
|
+
const ws = await wb.getWorksheet(0);
|
|
20
|
+
const table = await ws.getDataTable(); // [{ Name: "Alice", Age: 30 }, ...]
|
|
21
|
+
|
|
22
|
+
// Create a new file
|
|
23
|
+
await using wb2 = new ExcelWorkbook();
|
|
24
|
+
const ws2 = await wb2.createWorksheet("Sheet1");
|
|
25
|
+
await ws2.setRecords([{ Name: "Alice", Age: 30 }]);
|
|
26
|
+
const output = await wb2.getBytes();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Type-safe read/write with Zod (ExcelWrapper)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { ExcelWrapper } from "@simplysm/excel";
|
|
33
|
+
import { z } from "zod";
|
|
34
|
+
|
|
35
|
+
const schema = z.object({
|
|
36
|
+
name: z.string().describe("Name"),
|
|
37
|
+
age: z.number().describe("Age"),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const wrapper = new ExcelWrapper(schema);
|
|
41
|
+
|
|
42
|
+
// Read
|
|
43
|
+
const records = await wrapper.read(fileBytes);
|
|
44
|
+
|
|
45
|
+
// Write
|
|
46
|
+
await using wb = await wrapper.write("Members", records);
|
|
47
|
+
const output = await wb.getBytes();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Modules
|
|
51
|
+
|
|
52
|
+
| Module | Description | Details |
|
|
53
|
+
|--------|-------------|---------|
|
|
54
|
+
| `ExcelWorkbook` | Top-level workbook handle; open/create/export `.xlsx` files | [docs/workbook.md](docs/workbook.md) |
|
|
55
|
+
| `ExcelWorksheet` | Single worksheet; cell access, copy, data import/export, images | [docs/workbook.md](docs/workbook.md) |
|
|
56
|
+
| `ExcelRow` | Row handle; access cells in a row | [docs/workbook.md](docs/workbook.md) |
|
|
57
|
+
| `ExcelCol` | Column handle; access cells, set width | [docs/workbook.md](docs/workbook.md) |
|
|
58
|
+
| `ExcelCell` | Single cell; read/write values, formulas, styles, merge | [docs/workbook.md](docs/workbook.md) |
|
|
59
|
+
| `ExcelUtils` | Static helpers for address conversion and date/format conversion | [docs/utils.md](docs/utils.md) |
|
|
60
|
+
| `ExcelWrapper` | Zod schema-based type-safe read/write | [docs/wrapper.md](docs/wrapper.md) |
|
|
61
|
+
| Types | Value, address, style, and XML data type definitions | [docs/types.md](docs/types.md) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/excel",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.75",
|
|
4
4
|
"description": "Excel file processing library",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"mime": "^4.1.0",
|
|
23
23
|
"zod": "^4.3.6",
|
|
24
|
-
"@simplysm/core-common": "13.0.
|
|
24
|
+
"@simplysm/core-common": "13.0.75"
|
|
25
25
|
}
|
|
26
26
|
}
|