@simplysm/excel 13.0.97 → 13.0.98
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 +74 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @simplysm/excel
|
|
2
|
+
|
|
3
|
+
Excel file processing library. Platform-neutral (works in both browser and Node.js).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @simplysm/excel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exports
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
ExcelWorkbook,
|
|
16
|
+
ExcelWorksheet,
|
|
17
|
+
ExcelRow,
|
|
18
|
+
ExcelCol,
|
|
19
|
+
ExcelCell,
|
|
20
|
+
ExcelUtils,
|
|
21
|
+
ExcelWrapper,
|
|
22
|
+
} from "@simplysm/excel";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### Create a new workbook
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
await using wb = new ExcelWorkbook();
|
|
31
|
+
const ws = await wb.addWorksheet("Sheet1");
|
|
32
|
+
await ws.cell(0, 0).setValue("Name");
|
|
33
|
+
await ws.cell(0, 1).setValue("Age");
|
|
34
|
+
await ws.cell(1, 0).setValue("Alice");
|
|
35
|
+
await ws.cell(1, 1).setValue(30);
|
|
36
|
+
const bytes = await wb.toBytes();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Read an existing workbook
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
await using wb = new ExcelWorkbook(fileBytes);
|
|
43
|
+
const ws = await wb.getWorksheet(0);
|
|
44
|
+
const value = await ws.cell(0, 0).getValue();
|
|
45
|
+
const dataTable = await ws.getDataTable();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Type-safe read/write with Zod schema
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { z } from "zod";
|
|
52
|
+
|
|
53
|
+
const schema = z.object({
|
|
54
|
+
name: z.string().describe("Name"),
|
|
55
|
+
age: z.number().describe("Age"),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const wrapper = new ExcelWrapper(schema);
|
|
59
|
+
|
|
60
|
+
// Read
|
|
61
|
+
const records = await wrapper.read(fileBytes);
|
|
62
|
+
|
|
63
|
+
// Write
|
|
64
|
+
await using wb = await wrapper.write("Sheet1", [
|
|
65
|
+
{ name: "Alice", age: 30 },
|
|
66
|
+
]);
|
|
67
|
+
const bytes = await wb.toBytes();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
- [Types](docs/types.md)
|
|
73
|
+
- [Core Classes](docs/core-classes.md)
|
|
74
|
+
- [Wrapper](docs/wrapper.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/excel",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.98",
|
|
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.98"
|
|
25
25
|
}
|
|
26
26
|
}
|