Skip to content

Asynchronously stream worksheet rows with IAsyncEnumerable without loading the entire worksheet into memory #1860

@virzak

Description

@virzak

Is your feature request related to a problem? Please describe.
We have multiple, potentially huge files with multiple worksheets that we need to process. Rows are sorted in the order that we need. Currently the only way to read a row is to load the entire file with:

using (var package = new ExcelPackage());
await package.LoadAsync(file);

or

using (var package = new ExcelPackage(file));

This operation can take a long time. It doesn't have System.IProgress argument, so the user is left hanging.
It can also take a huge amount of memory.

Describe the solution you'd like

We need a solution which allows the user to read a single row without loading the entire file into the memory. In our case, we don't even need to jump between arbitrary rows, we simply need the rows consecutively. A signature could look like:

async IAsyncEnumerable<ExcelRange[]> ExcelWorksheet.GetAllRowsAsync()

This operation should return start returning rows immediately without loading nothing into except only the buffer needed to stream rows.
Merged cells would only be returned once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions