xlsx-for-ai 1.1.0 → 1.3.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.
Files changed (3) hide show
  1. package/README.md +42 -10
  2. package/index.js +795 -210
  3. package/package.json +6 -2
package/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # xlsx-for-ai
2
2
 
3
- Converts `.xlsx` files into rich text or JSON dumps that AI coding agents can actually read.
3
+ Converts spreadsheets into text, **markdown**, JSON, SQL, or schema dumps that AI coding agents can actually read.
4
4
 
5
- AI tools — Claude, Cursor, Copilot, ChatGPT, and other LLM coding agents — can read text files but **not** `.xlsx` binaries. This CLI bridges the gap. It extracts everything a human would see in Excel and writes it to a plain text file (or structured JSON):
5
+ AI tools — Claude, Cursor, Copilot, ChatGPT, and other LLM coding agents — can read text files but **not** `.xlsx` binaries. This CLI bridges the gap.
6
+
7
+ **Input formats:** `.xlsx` `.xls` `.xlsb` `.ods` `.csv` `.tsv`
8
+
9
+ **Output modes:** text dump, markdown tables (best LLM comprehension per token), JSON, SQL `CREATE TABLE`+`INSERT`, inferred schema, workbook diff.
10
+
11
+ It extracts everything a human would see in Excel:
6
12
 
7
13
  - **Values** — strings, numbers, dates
8
14
  - **Formulas** — the actual formula expression, plus shared-formula references
@@ -66,18 +72,44 @@ npx xlsx-for-ai data.xlsx "Sheet1" --stdout --max-rows 50 --compact
66
72
 
67
73
  ### Options
68
74
 
75
+ **Output modes** (mutually exclusive; default = text):
76
+
77
+ | Flag | Description |
78
+ |------|-------------|
79
+ | `--md` | Markdown tables — highest LLM comprehension per token |
80
+ | `--json` | Structured JSON, one object per cell |
81
+ | `--sql` | `CREATE TABLE` + `INSERT` statements (uses inferred schema) |
82
+ | `--schema` | Per-column schema (name, type, nullable, samples) as JSON |
83
+
84
+ **Selection:**
85
+
86
+ | Flag | Description |
87
+ |------|-------------|
88
+ | `[sheetName]` | Positional: dump only this sheet |
89
+ | `--range A1:D50` | Dump only this rectangular range |
90
+ | `--named-range NAME` | Dump only the cells covered by a workbook-defined name |
91
+ | `--max-rows N` | Cap at the first N rows per sheet |
92
+ | `--max-cols N` | Cap at the first N columns per sheet |
93
+
94
+ **Output control:**
95
+
96
+ | Flag | Description |
97
+ |------|-------------|
98
+ | `--list-sheets` | Print sheet names + dimensions and exit |
99
+ | `--stdout` | Print to stdout instead of writing files in `.xlsx-read/` |
100
+ | `--compact` | Suppress noisy default tags (default colors, "General" format) |
101
+ | `--max-tokens N` | Truncate output to ~N tokens; appends a tail summary noting what was dropped |
102
+ | `--evaluate` | Promote cached formula results to primary value; re-evaluate simple formulas via formulajs |
103
+
104
+ **Other modes:**
105
+
69
106
  | Flag | Description |
70
107
  |------|-------------|
71
- | `--list-sheets` | Print sheet names, row/column counts, and visibility then exit |
72
- | `--stdout` | Print output to stdout instead of writing `.txt` files |
73
- | `--json` | Emit structured JSON (one object per cell with value/formula/format/style) |
74
- | `--compact` | Suppress noisy default tags (default text color, white fill, etc.) — reduces token usage for AI agents |
75
- | `--max-rows N` | Cap output at the first N rows per sheet |
76
- | `--max-cols N` | Cap output at the first N columns per sheet |
77
- | `-h`, `--help` | Show help message |
108
+ | `--diff OTHER` | Diff this workbook vs `OTHER` emit changed/added/removed cells and sheets |
109
+ | `--stream` | Streaming reader for huge `.xlsx` files (>100MB); emits row-by-row, drops some sheet metadata |
110
+ | `-h`, `--help` | Show help |
78
111
 
79
112
  Output files are written to `.xlsx-read/` in the current working directory.
80
- Each sheet produces a file named `<filename>--<sheetname>.txt`.
81
113
  The path(s) are printed to stdout so your agent knows where to read.
82
114
 
83
115
  ## Output Format