sheetjs-formula-recalc 0.37.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.
package/AGENTS.md ADDED
@@ -0,0 +1,36 @@
1
+ # sheetjs-formula-recalc Agent Notes
2
+
3
+ Use this package when a Node.js task already uses SheetJS or `xlsx` for workbook
4
+ file I/O but needs fresh formula values after editing input cells.
5
+
6
+ Start with the one-command proof:
7
+
8
+ ```sh
9
+ npx --package sheetjs-formula-recalc sheetjs-recalc --demo --json
10
+ ```
11
+
12
+ For a real workbook, use sheet-qualified A1 targets:
13
+
14
+ ```sh
15
+ npx --package sheetjs-formula-recalc sheetjs-recalc quote.xlsx \
16
+ --set Inputs!B2=48 \
17
+ --read Summary!B7 \
18
+ --out quote.recalculated.xlsx \
19
+ --json
20
+ ```
21
+
22
+ Use the API when code already has workbook bytes:
23
+
24
+ ```ts
25
+ import { recalculateSheetjsWorkbook } from 'sheetjs-formula-recalc'
26
+
27
+ const result = recalculateSheetjsWorkbook(xlsxBytes, {
28
+ edits: [{ target: 'Inputs!B2', value: 48 }],
29
+ reads: ['Summary!B7'],
30
+ })
31
+ ```
32
+
33
+ Do not claim this is a full Excel clone or a SheetJS replacement. Keep SheetJS
34
+ for file I/O, review `result.warnings`, and reduce unsupported functions,
35
+ external links, macros, and volatile formula cases into fixtures before
36
+ promising production behavior.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) bilig 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,116 @@
1
+ # sheetjs-formula-recalc
2
+
3
+ Recalculate SheetJS / `xlsx` formula workbooks in Node.js without opening
4
+ Excel, LibreOffice, or a browser.
5
+
6
+ Use this package when the rest of your pipeline already uses SheetJS or the
7
+ `xlsx` package for workbook file I/O, but a backend job needs fresh formula
8
+ readback after changing inputs.
9
+
10
+ ## If You Arrived From a SheetJS Formula Issue
11
+
12
+ SheetJS is good at reading and writing spreadsheet files. The common production
13
+ gap is different:
14
+
15
+ - `SheetJS formula result not updating`
16
+ - `xlsx formula value stale after edit`
17
+ - `js-xlsx recalculate formulas`
18
+ - `refresh formula cells in xlsx node`
19
+
20
+ Formula cells can carry cached results. When a Node process edits `Inputs!B2`,
21
+ the cached value in `Summary!B7` is not automatically recalculated inside that
22
+ process.
23
+
24
+ Use this package at the file boundary:
25
+
26
+ 1. let SheetJS produce or update XLSX bytes;
27
+ 2. call `recalculateSheetjsWorkbook(...)`;
28
+ 3. read proof cells from `result.reads`;
29
+ 4. write `result.xlsx` if the updated artifact is needed.
30
+
31
+ This package is a SheetJS-named bridge over `xlsx-formula-recalc`, so teams
32
+ searching for a SheetJS answer can find the right boundary directly.
33
+
34
+ ## Install
35
+
36
+ ```sh
37
+ npm install sheetjs-formula-recalc
38
+ ```
39
+
40
+ ## CLI
41
+
42
+ Run a self-contained proof first:
43
+
44
+ ```sh
45
+ npx --package sheetjs-formula-recalc sheetjs-recalc --demo --json
46
+ ```
47
+
48
+ For a real workbook:
49
+
50
+ ```sh
51
+ npx --package sheetjs-formula-recalc sheetjs-recalc quote.xlsx \
52
+ --set Inputs!B2=48 \
53
+ --set Inputs!B3=1500 \
54
+ --read Summary!B7 \
55
+ --out quote.recalculated.xlsx \
56
+ --json
57
+ ```
58
+
59
+ The command writes the recalculated XLSX and prints the requested read cells.
60
+
61
+ ## TypeScript
62
+
63
+ ```ts
64
+ import { readFile, writeFile } from 'node:fs/promises'
65
+ import { recalculateSheetjsWorkbook } from 'sheetjs-formula-recalc'
66
+
67
+ const result = recalculateSheetjsWorkbook(await readFile('quote.xlsx'), {
68
+ fileName: 'quote.xlsx',
69
+ edits: [
70
+ { target: 'Inputs!B2', value: 48 },
71
+ { target: 'Inputs!B3', value: 1500 },
72
+ ],
73
+ reads: ['Summary!B7'],
74
+ })
75
+
76
+ await writeFile('quote.recalculated.xlsx', result.xlsx)
77
+
78
+ console.log({
79
+ value: result.reads['Summary!B7'],
80
+ warnings: result.warnings,
81
+ })
82
+ ```
83
+
84
+ ## Proof Against SheetJS, xlsx-populate, and ExcelJS
85
+
86
+ The repository includes a cross-library proof:
87
+
88
+ ```sh
89
+ git clone https://github.com/proompteng/bilig.git
90
+ cd bilig
91
+ npm --prefix examples/recalc-bridge-workflows install
92
+ npm --prefix examples/recalc-bridge-workflows run smoke
93
+ ```
94
+
95
+ It edits the same workbook through SheetJS/`xlsx`, `xlsx-populate`, and
96
+ ExcelJS, then verifies that Bilig refreshes the stale `48000` result to
97
+ `72000`.
98
+
99
+ ## What This Is Not
100
+
101
+ This is not a full Excel clone and not a replacement for SheetJS file I/O. Keep
102
+ SheetJS where it is strongest: parsing, writing, and transforming workbook
103
+ files. Add this package only where the Node process must own recalculated
104
+ formula readback before accepting, rejecting, returning, or persisting a
105
+ workflow.
106
+
107
+ Review `result.warnings` and keep fixtures for unsupported functions, external
108
+ workbook links, macros, volatile functions, and customer-critical templates.
109
+
110
+ ## Related
111
+
112
+ - [SheetJS formula result not updating in Node.js](https://proompteng.github.io/bilig/sheetjs-formula-result-not-updating-node.html)
113
+ - [XLSX formula recalculation in Node.js](https://proompteng.github.io/bilig/xlsx-formula-recalculation-node.html)
114
+ - [SheetJS and ExcelJS boundary guide](https://proompteng.github.io/bilig/sheetjs-exceljs-alternative-formula-workbook-api.html)
115
+ - [`xlsx-formula-recalc`](https://www.npmjs.com/package/xlsx-formula-recalc)
116
+ - [`@bilig/headless`](https://www.npmjs.com/package/@bilig/headless)
package/SKILL.md ADDED
@@ -0,0 +1,38 @@
1
+ # SheetJS Formula Recalculation
2
+
3
+ Use `sheetjs-formula-recalc` when an agent or Node.js service has changed XLSX
4
+ inputs through SheetJS / `xlsx` and must read recalculated formula outputs
5
+ without opening Excel, LibreOffice, or a browser.
6
+
7
+ ## First Check
8
+
9
+ ```sh
10
+ npx --package sheetjs-formula-recalc sheetjs-recalc --demo --json
11
+ ```
12
+
13
+ The demo should print `verified: true` and a `Summary!B2` value of `72000`.
14
+
15
+ ## Real Workbook
16
+
17
+ ```sh
18
+ npx --package sheetjs-formula-recalc sheetjs-recalc workbook.xlsx \
19
+ --set Inputs!B2=48 \
20
+ --read Summary!B7 \
21
+ --out workbook.recalculated.xlsx \
22
+ --json
23
+ ```
24
+
25
+ ## TypeScript
26
+
27
+ ```ts
28
+ import { recalculateSheetjsWorkbook } from 'sheetjs-formula-recalc'
29
+
30
+ const result = recalculateSheetjsWorkbook(inputXlsxBytes, {
31
+ edits: [{ target: 'Inputs!B2', value: 48 }],
32
+ reads: ['Summary!B7'],
33
+ })
34
+ ```
35
+
36
+ Use `xlsx-formula-recalc` when the caller does not care about SheetJS naming,
37
+ and use `exceljs-formula-recalc` when the caller owns an ExcelJS `Workbook`
38
+ object and wants read results patched back into that object.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { runXlsxFormulaRecalcCli } from 'xlsx-formula-recalc/cli-api';
3
+ process.exitCode = runXlsxFormulaRecalcCli(process.argv.slice(2), {
4
+ commandName: 'sheetjs-recalc',
5
+ });
6
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAErE,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAChE,WAAW,EAAE,gBAAgB;CAC9B,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { WorkPaper, exportXlsx, importXlsx, parseQualifiedA1, parseQualifiedCellTarget, recalculateXlsx as recalculateSheetjsWorkbook, recalculateXlsx, } from 'xlsx-formula-recalc';
2
+ export type { XlsxFormulaRecalcCellValue, XlsxFormulaRecalcEdit, XlsxFormulaRecalcOptions, XlsxFormulaRecalcResult, } from 'xlsx-formula-recalc';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { WorkPaper, exportXlsx, importXlsx, parseQualifiedA1, parseQualifiedCellTarget, recalculateXlsx as recalculateSheetjsWorkbook, recalculateXlsx, } from 'xlsx-formula-recalc';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,IAAI,0BAA0B,EAC7C,eAAe,GAChB,MAAM,qBAAqB,CAAA"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "sheetjs-formula-recalc",
3
+ "version": "0.37.0",
4
+ "description": "Recalculate SheetJS and xlsx workbook formulas in Node.js without Excel, LibreOffice, or browser automation.",
5
+ "keywords": [
6
+ "excel",
7
+ "excel-formulas",
8
+ "formula-engine",
9
+ "formula-recalculation",
10
+ "js-xlsx",
11
+ "node",
12
+ "sheetjs",
13
+ "sheetjs-formula",
14
+ "sheetjs-recalc",
15
+ "spreadsheet",
16
+ "spreadsheet-formulas",
17
+ "workbook",
18
+ "xlsx",
19
+ "xlsx-calc",
20
+ "xlsx-formula",
21
+ "xlsx-formula-recalculation",
22
+ "xlsx-recalc",
23
+ "xlsx-recalculation"
24
+ ],
25
+ "homepage": "https://proompteng.github.io/bilig/sheetjs-formula-result-not-updating-node.html",
26
+ "bugs": {
27
+ "url": "https://github.com/proompteng/bilig/issues"
28
+ },
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/proompteng/bilig.git",
33
+ "directory": "packages/sheetjs-formula-recalc"
34
+ },
35
+ "bin": {
36
+ "sheetjs-recalc": "./dist/cli.js"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "AGENTS.md",
41
+ "SKILL.md",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "type": "module",
46
+ "sideEffects": false,
47
+ "main": "./dist/index.js",
48
+ "types": "./dist/index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./dist/index.d.ts",
52
+ "import": "./dist/index.js"
53
+ }
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "dependencies": {
59
+ "xlsx-formula-recalc": "0.37.0"
60
+ },
61
+ "engines": {
62
+ "node": ">=22.0.0"
63
+ },
64
+ "scripts": {
65
+ "build": "pnpm --dir ../.. --filter xlsx-formula-recalc build && rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json",
66
+ "smoke": "node ./dist/cli.js --help"
67
+ }
68
+ }