镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Feature] - Support Tables and Table Styles during Export #975

Open

Description

@JustinGrote

Feature Summary

Excel Tables aka SpreadsheetML Tables are a very powerful feature that are easily enabled just by adding them to the tables XML. MiniExcel already supports reading from tables, it should also support writing to tables. The default export mode should use a table rather than table-like stylings.

Document Formats

What document formats will benefit from this new functionality?

  • XLSX
  • CSV
  • XLSM
  • Other

Motivation

Utilize Tables in Excel Spreadsheets for easier pivot table, access via tools such as PowerBI, etc.

Proposed Solution

ExportAsync (and similar) take a TableName parameter (default Table1 if not specified), and update the TableStyle enum to include all the table styles (e.g. Medium2). Default Style should be TableStyleMedium2 which most closely matches the existing format. This could also be done in the OpenXMLConfiguration.

  • If exporting to an existing sheet and tablename is specifid, export to that table, erroring if the data format does not fit the existing column format.

Alternatives Considered

Currently opening and adding the table via ClosedXML as a workaround after export.

Willing to attempt PR if accepted

Activity

  1. michelebastione commented on Jun 26, 2026

    @michelebastione
    Collaborator

    This is an interesting proposition, I do believe it would be a good change and it shouldn't be too complicated to implement for new documents, but I'm a little worried about the implementation for inserting data into existing document, it could get messy very easily. Similar concerns are due for multi-sheet exports. We'll have to do some viability analysis about this.

  2. michelebastione commented on Jun 28, 2026

    @michelebastione
    Collaborator

    So, after some evaluation I've encountered a significant roadblock, which is the fact that MiniExcel allows for exporting properties to arbitrary non-adjacent columns through the MiniExcelColumnIndex attribute. This behaviour is incompatible with assigning the whole spreadsheet range to a table, as a table cannot contain discontinuities by definition. This would be a major breaking change if it were to be set as the default export mode. We could try to add it as a secondary export mode instead, but it'll require some more investigation.

  3. JustinGrote commented on Jun 28, 2026

    @JustinGrote
    Author

    I'd be perfectly fine with:

    1. Requiring cells to be empty before applying a table style to avoid the complications around inserting data
    2. Making it a configuration behavior rather than the default, as a library consumer (in my case the ExcelFast PowerShell module) can choose to make it default.
    3. Having the configuration behavior be gated or throw an exception on non-continguous ranges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions