dify icon indicating copy to clipboard operation
dify copied to clipboard

Knowledge import fails for XLSX workbooks containing a chart sheet

Open juemimgcd opened this issue 1 week ago • 1 comments

Self Checks

  • [x] I have read the Contributing Guide and Language Policy.
  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report, otherwise it will be closed.
  • [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

main at 5e38d73d8f44b3c899c0ee64dd8d038813a2194a

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. Create an Excel workbook with a worksheet named Sales. Enter two column headings, Month and Amount, and two data rows, January, 125 and February, 180.
  2. Insert a chart using that data. In Excel, choose Move Chart → New sheet so the chart has its own tab. Save the file as .xlsx.
  3. Import the file into a knowledge base using the built-in extractor. For a local reproduction, call ExcelExtractor(path).extract() on the saved workbook.

I reproduced this through ExtractProcessor.extract() with ETL_TYPE=dify and openpyxl 3.1.5. As controls, both the plain workbook and the workbook with the chart embedded in the Sales worksheet returned the two sales rows.

✔️ Expected Behavior

The extractor returns the two rows from Sales. The separate chart sheet has no tabular rows to index.

❌ Actual Behavior

Extraction aborts before it can return any documents:

AttributeError: 'Chartsheet' object has no attribute 'iter_rows'

The XLSX loop enumerates all sheet names. It passes the chart sheet to the header scanner, which calls iter_rows().

juemimgcd avatar Nov 25 '26 09:11 juemimgcd

For an immediate workaround, save a copy of the workbook, move the chart back onto Sales as an embedded chart, and import the copy. Your control test shows that this preserves both sales rows without changing the original workbook (repro).

For the maintainer fix, the XLSX extractor should iterate wb.worksheets and use sheet.title where it needs the name. Unlike wb.sheetnames, wb.worksheets excludes chart sheets, so they never reach the iter_rows() header scan [1] [2] [3]. A regression test with a real .xlsx containing both Sales and a chart sheet should assert that extraction returns exactly the two sales rows.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about dify with Dosu

dosubot[bot] avatar Nov 25 '26 09:11 dosubot[bot]