Repository navigation
Add overload to sheet appender to take batchinformation class, add an optional callback function - #56
Conversation
… optional callback function on each batch
There was a problem hiding this comment.
🟡 Changes recommended
The callback and delay run after the final full batch when no additional records remain.
1 open finding
What changed in this PR
Adds shared batch configuration and cancellation callbacks to sheet append operations.
Changes:
- Adds
BatchInformationfor batch settings and cancellation. - Consolidates CSV/object batching into a shared helper.
- Preserves existing overloads.
| File | Description |
|---|---|
SheetAppender.cs |
Adds overloads and shared batching logic. |
BatchInformation.cs |
Defines batch configuration and callback. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (batchInformation.ShouldCancel?.Invoke() == true) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| Thread.Sleep(batchInformation.BatchWaitTime); |
There was a problem hiding this comment.
@drgrieve, can you review the copilot suggestion and see if that update makes sense please?
There was a problem hiding this comment.
Yes that is an issue @SteveWinward.
I've add a unit test for SheetAppender and added a failing test to reproduce the issue.
Then added a fix for this.
…ze is divisible by number of records
|
@drgrieve I just released 2.0.28 with your changes. Thank you for the addition! |

Adds an optional batch callback to support heartbeat signals during long-running sheet append operations. The callback runs between batches, allowing callers to report progress or cancel processing when needed without changing existing overload behavior.
Added AppendDataRecords helper function to reduce duplicated logic.
Tested against a sheet operation using AppendObject for 33K rows, split into batches of 500, with a 500ms wait time.