Skip to content

Slow table parsing for huge tables #1516

@Trace2333

Description

@Trace2333

`from docx.table import _Cell, Table
from docx.oxml.table import CT_Tbl

elif isinstance(child, CT_Tbl):
# table -> JSON
# DEBUG
table_obj = Table(child, parent)
list_table = [[k.text for k in j.cells] for j in table_obj.rows]
str_table = self.list_to_md_table(list_table)
yield str_table`

This is my current code reads Word tables and converts them to JSON, but performance degrades significantly when handling large tables — for example, a 9000-row × 10-column table takes too long to parse.

Is there a way to optimize or accelerate this process? Any suggestions for improving efficiency would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions