Is it possible to stream an excel file row-by-row using C1Excel?

Posted by: jacob.a.buchanan6.ctr on 20 November 2025, 2:01 pm EST

    • Post Options:
    • Link

    Posted 20 November 2025, 2:01 pm EST

    We have a C#/WPF app that has a focus on high-speed analysis of data, and we use C1 heavily throughout for styling. One of the functions of this app involves reading in and parsing data from files. We typically deal with text & csv files, but recently there has been a request for reading XLSX files as well. We would prefer to just use C1Excel, but we have run into some performance issues.

    We have a system in place for users to define the structure of their files which we use for reading the file. Then whenever the user imports files we try and match each file to a definition. This is typically done by streaming the first line of the text/csv and checking the structure against each defined format to look for a match. We want to apply the same logic for XLSX files, but I only see an option to load the entire file using book.Load(filePath). Some of these XLSX files are quite large(10+mb), so loading the entire file just to check sheet names or the first row of data just to realize it is not a match is not very efficient.

    We can look into other excel readers if C1Excel does not support this, but we are on a private network so getting new packages can be a little difficult, so we were hoping we could make it work with C1Excel.

    Any tips/tricks would be appreciated!

  • Posted 22 November 2025, 3:12 pm EST

    Hi Jacob,

    We are currently looking into issue. We will update you soon on this.

    Thanks & regards,

    Aastha

  • Posted 24 November 2025, 5:22 am EST

    Hi Jacob,

    Thanks for the detailed explanation about your use-case. C1Excel always loads the full XLSX workbook when calling book.Load(), so it doesn’t support partial or streaming reads. For scenarios where you only need to check sheet names or the first row to validate the file format, a faster approach is to inspect the XLSX file directly as a ZIP package instead of loading it through C1Excel.

    XLSX files contain small XML parts such as ‘xl/workbook.xml’ (sheet list) and ‘xl/worksheets/sheet1.xml’ (sheet data). Using .NET’s built-in ZipArchive and XDocument, you can read only these small XML files and avoid loading the entire workbook, which significantly improves performance for large files.

    References:

    • ZIP access with System.IO.Compression.ZipArchive:

    https://learn.microsoft.com/dotnet/api/system.io.compression.ziparchive

    • LINQ to XML (XDocument) for reading workbook XML:

    https://learn.microsoft.com/dotnet/api/system.xml.linq.xdocument

    Once the structure matches your definitions, you can proceed with a full C1XLBook.Load() only for those files.

    Hope this helps you!

    Kind regards,

    Aastha

  • Posted 3 December 2025, 5:58 pm EST

    Thanks! That is an interesting approach. I did not realize XLSX files contained all those XML docs. We were playing around with this idea, and I believe it will improve on some of our processing speed. It might get quite complex interpreting the XML even when using XDocument, so we will likely try a 3rd party tool that is designed specifically for efficiently reading XLSX files.

    Regardless, you thoroughly answered my question, so thanks for your help!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels