@bilig/xlsx-formula-recalc 0.93.0 → 0.94.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 (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -75,6 +75,31 @@ The CLI writes a recalculated workbook and prints readback values. Cell targets
75
75
  must be sheet-qualified A1 references such as `Inputs!B2` or
76
76
  `'Pricing Model'!F12`.
77
77
 
78
+ For workbooks with external links, pass companion workbook files so cached link
79
+ values can be refreshed before recalculation:
80
+
81
+ ```sh
82
+ npx --package @bilig/xlsx-formula-recalc xlsx-recalc model.xlsx \
83
+ --external-workbook rates.xlsx \
84
+ --read Model!C1 \
85
+ --out model.recalculated.xlsx \
86
+ --json
87
+ ```
88
+
89
+ When the link target in the workbook is an exact path or URI that does not match
90
+ the local companion filename, bind the companion explicitly:
91
+
92
+ ```sh
93
+ npx --package @bilig/xlsx-formula-recalc xlsx-recalc model.xlsx \
94
+ --external-workbook-target ./fixtures/rates-current.xlsx file:///tmp/rates.xlsx \
95
+ --read Model!C1 \
96
+ --json
97
+ ```
98
+
99
+ Ambiguous companion matches fail closed: the command preserves existing
100
+ external-link cache values, emits a warning, and includes hydration diagnostics
101
+ in JSON output.
102
+
78
103
  ## API
79
104
 
80
105
  ```ts
@@ -92,6 +117,23 @@ await fs.promises.writeFile('pricing.recalculated.xlsx', result.xlsx)
92
117
  console.log(result.reads['Summary!B7'])
93
118
  ```
94
119
 
120
+ External companion workbooks use the same matching rules as the CLI:
121
+
122
+ ```ts
123
+ const result = recalculateXlsx(await fs.promises.readFile('model.xlsx'), {
124
+ externalWorkbooks: [
125
+ {
126
+ bytes: await fs.promises.readFile('rates.xlsx'),
127
+ fileName: 'rates.xlsx',
128
+ target: 'file:///tmp/rates.xlsx',
129
+ },
130
+ ],
131
+ reads: ['Model!C1'],
132
+ })
133
+
134
+ console.log(result.diagnostics?.externalWorkbookHydration)
135
+ ```
136
+
95
137
  If another library already produced the workbook bytes, pass those bytes
96
138
  directly:
97
139
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/xlsx-formula-recalc",
3
- "version": "0.93.0",
3
+ "version": "0.94.0",
4
4
  "description": "Scoped XLSX formula recalculation package for Node.js without Excel, LibreOffice, or browser automation.",
5
5
  "keywords": [
6
6
  "bilig",
@@ -63,7 +63,7 @@
63
63
  "smoke": "node ./dist/cli.js --help"
64
64
  },
65
65
  "dependencies": {
66
- "xlsx-formula-recalc": "0.93.0"
66
+ "xlsx-formula-recalc": "0.94.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=22.0.0"