@markitdownjs/xlsx 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +60 -0
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MarkItDownJS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @markitdownjs/xlsx
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@markitdownjs/xlsx)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Excel (XLSX) to AST converter for MarkItDownJS. Converts spreadsheet sheets into structured `TableNode` AST nodes with headers and rows.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @markitdownjs/xlsx
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { MarkItDown } from "@markitdownjs/core";
|
|
18
|
+
import { XlsxConverter } from "@markitdownjs/xlsx";
|
|
19
|
+
|
|
20
|
+
const parser = new MarkItDown();
|
|
21
|
+
parser.registerConverter(new XlsxConverter());
|
|
22
|
+
|
|
23
|
+
const result = await parser.convert({
|
|
24
|
+
source: xlsxBuffer,
|
|
25
|
+
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
26
|
+
});
|
|
27
|
+
console.log(result.markdown);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Key Exports
|
|
31
|
+
|
|
32
|
+
| Export | Description |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `XlsxConverter` | Converter plugin — register with `MarkItDown` |
|
|
35
|
+
|
|
36
|
+
## What Gets Extracted
|
|
37
|
+
|
|
38
|
+
- Each sheet becomes a separate `TableNode` with the sheet name as a heading
|
|
39
|
+
- First row treated as the header row (configurable)
|
|
40
|
+
- Cell values normalized to strings; numbers and dates are formatted
|
|
41
|
+
- Empty rows and columns are skipped by default
|
|
42
|
+
|
|
43
|
+
## Options
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
parser.registerConverter(new XlsxConverter({
|
|
47
|
+
firstRowAsHeader: true,
|
|
48
|
+
skipEmptyRows: true,
|
|
49
|
+
sheets: ["Sheet1", "Summary"], // process only specific sheets
|
|
50
|
+
}));
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Accepted MIME Types
|
|
54
|
+
|
|
55
|
+
- `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
|
|
56
|
+
- `application/vnd.ms-excel`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
Part of the [MarkItDownJS](https://github.com/markitdownjs/markitdownjs) monorepo.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markitdownjs/xlsx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Excel (XLSX) converter for MarkItDownJS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"jszip": "^3.10.0",
|
|
21
|
-
"@markitdownjs/ast": "0.1.
|
|
22
|
-
"@markitdownjs/shared": "0.1.
|
|
21
|
+
"@markitdownjs/ast": "0.1.1",
|
|
22
|
+
"@markitdownjs/shared": "0.1.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^5.5.0"
|