You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,11 @@ Typed and structured visitors plus sheet names, information, dimensions, and col
112
112
113
113
Dynamic, explicit-schema, typed, and multi-sheet workbooks can be written to a borrowed `Write + Send` sink with the `*_to_writer` APIs. The library does not close readers or writers. Reader position is unspecified after a call. Writer output begins at the current position and does not truncate existing content, so callers should provide an empty or already-truncated sink.
114
114
115
+
Existing workbooks can be appended to or replaced through separate borrowed streams with the
116
+
`insert*_from_reader_to_writer` APIs. These require a `Read + Seek` source and an empty
117
+
`Write + Seek` destination. Both remain open, but output is not atomic and is not rolled back after
118
+
a destination error. Source and destination must not alias the same underlying stream.
119
+
115
120
> **Memory boundary:** the streaming path keeps workbook metadata, styles, a small row channel, and parser buffers in memory. Shared-string tables at least 5 MiB spill to indexed temporary files by default; dropping the iterator removes them. Configure this with `with_shared_string_disk_cache()`, `with_shared_string_cache_size()`, and `with_shared_string_cache_path()`. The directory must already exist. Byte/WASM queries always keep shared strings in memory. Worksheet XML and prior rows are never retained. Peak memory can still grow with a single exceptionally large row, but not with the full worksheet row count.
116
121
117
122
## Structured Streaming Query
@@ -291,6 +296,15 @@ assert_eq!(count, 1);
291
296
292
297
`insert_with_schema()` accepts a fallible, one-pass dynamic iterator. Source rows are disk-spooled and the constant-memory backend retains only the current row while generating the donor workbook; style rebasing currently materializes the generated worksheet XML. `insert_serialized()` accepts Serde structs. Existing unrelated ZIP entries, worksheet identities, formulas, and cached values are preserved, and an existing workbook is replaced only after the rewritten package validates and syncs.
293
298
299
+
For separate borrowed streams, use `insert_from_reader_to_writer()`,
300
+
`insert_with_schema_from_reader_to_writer()`, or
301
+
`insert_serialized_from_reader_to_writer()`. The source must implement `Read + Seek`, the
302
+
destination must implement `Write + Seek`, and both remain open. The destination must be empty:
303
+
MiniExcel neither truncates it nor rolls it back after an error, so a destination failure can
304
+
leave a partial XLSX package. The two handles must not alias the same underlying stream. These
305
+
stream APIs preserve the same package behavior as path Insert but do not provide its atomic commit
306
+
or post-write validation guarantee.
307
+
294
308
The default `ExistingSheetPolicy::Reject` rejects duplicate worksheet names case-insensitively. Use `ExistingSheetPolicy::Replace` to replace a worksheet in place while preserving its workbook order, ID, relationship/path, visibility, and active state. The default `TargetRelationshipPolicy::Reject` accepts only a plain target with no worksheet relationships. `RemoveSupported` can remove target-owned tables, drawings with exclusively owned images, comments, VML drawings, and external hyperlinks; pivots, external links, unknown relationships, and shared/global parts are rejected or preserved conservatively. Insert writes XLSX packages, rejects macro-enabled `.xlsm` paths, and rejects `WriteOptions::with_overwrite_file(true)` because workbook replacement is controlled by the insert policy.
295
309
296
310
Appending a formula-free worksheet preserves an existing calculation chain and workbook calculation properties. Replacement removes the complete stale `calcChain` part, relationship, and content-type override, then sets `fullCalcOnLoad` and `forceFullCalc` so Excel recalculates on the next open. MiniExcel does not evaluate or rewrite formulas; formulas and cached values in untouched worksheets remain byte-identical.
| Multi-sheet export |`save_as_sheets()` / `save_as_serialized_sheets()`| Preserves input sheet order and returns data-row counts |
50
-
|`InsertSheet` append/replace |`insert()` / `insert_with_schema()` / `insert_serialized()`| Atomic append; strict in-place replacement preserves sheet identity and has an explicit relationship policy|
50
+
|`InsertSheet` append/replace |`insert()` / `insert_with_schema()` / `insert_serialized()`/ borrowed reader-to-writer variants | Path APIs are atomic; separate borrowed streams require an empty sink and preserve package behavior without atomic commit|
51
51
| Per-sheet visibility |`WriteOptions::with_sheet_visibility()`| Visible, hidden, and very hidden; first visible sheet is active |
52
52
|`overwriteFile`|`WriteOptions::with_overwrite_file()`| Defaults to `false`; existing paths require explicit opt-in |
53
53
|`FreezeRowCount` / `FreezeColumnCount`|`WriteOptions::with_freeze_row_count()` / `with_freeze_column_count()`| Defaults to one frozen row and zero frozen columns |
@@ -114,7 +114,7 @@ Path RAG exports retain parser state, repeated header context, and one output ch
114
114
115
115
The backend makes two sequential, bounded-memory passes over the selected worksheet entry. The first records the used extent and compact merged-cell rectangles. This is required for MiniExcel-compatible stable dynamic schemas when legal files omit `<dimension>`, to preserve style-only row elements like the .NET reader, and to support opt-in merged-cell filling without expanding ranges into an address map. The second pass emits rows and retains only anchor values for currently active merged ranges. Worksheet XML and prior rows are never retained; memory consists primarily of in-memory or disk-indexed shared strings, styles, merge metadata, parser buffers, the current row, and the bounded channel.
116
116
117
-
The internal writer assembles a new ZIP package with one or more worksheets. Path saves refuse existing files by default and can explicitly replace them. Insert APIs append a worksheet through a validated package rewrite and atomic sibling-file replacement; unchanged ZIP entries and existing worksheet identities are preserved. Fallible explicit-schema producers are consumed once through a disk spool and a constant-memory worksheet writer, while the generated donor worksheet XML is materialized for style rebasing. Template fills rewrite worksheet XML within a copied package; worksheet styles and unrelated ZIP parts are retained. Array expansion shifts row and cell addresses and updates the worksheet dimension. Formula expressions are preserved but not recalculated, and version 1 does not adjust formula references, merged ranges, tables, drawings, or defined names after inserted rows.
117
+
The internal writer assembles a new ZIP package with one or more worksheets. Path saves refuse existing files by default and can explicitly replace them. Path Insert APIs append or replace a worksheet through a validated package rewrite and atomic sibling-file replacement; unchanged ZIP entries and existing worksheet identities are preserved. Separate borrowed Insert APIs accept `Read + Seek` input and an empty `Write + Seek` output, leave both open, and preserve the same package behavior without atomic commit, rollback, or post-write validation. Fallible explicit-schema producers are consumed once through a disk spool and a constant-memory worksheet writer, while the generated donor worksheet XML is materialized for style rebasing. Template fills rewrite worksheet XML within a copied package; worksheet styles and unrelated ZIP parts are retained. Array expansion shifts row and cell addresses and updates the worksheet dimension. Formula expressions are preserved but not recalculated, and version 1 does not adjust formula references, merged ranges, tables, drawings, or defined names after inserted rows.
0 commit comments