Skip to content

excel_describe_sheets returns empty usedRange for files without <dimension> tag #66

@ttnyt8701

Description

@ttnyt8701

Description

excel_describe_sheets returns an empty usedRange for Excel files that lack the <dimension> XML tag in their worksheet XML (xl/worksheets/sheet*.xml), even though the file contains valid data.

Steps to Reproduce

  1. Obtain an Excel file exported from certain tools/systems that do not include the <dimension> tag (e.g., some Japanese business software exports)
  2. Call excel_describe_sheets with the file

Expected Behavior

usedRange should reflect the actual data range (e.g., "A1:Z386").

Actual Behavior

{
  "backend": "excelize",
  "sheets": [
    {
      "name": "シート1",
      "usedRange": "",
      "tables": [],
      "pivotTables": [],
      "pagingRanges": []
    }
  ]
}

usedRange is empty, and subsequent excel_read_sheet calls also fail with "Invalid argument: no range available to read".

Root Cause

The <dimension> element is optional per the OOXML spec (ISO/IEC 29500). However, the excelize backend appears to rely on it for usedRange calculation. When the tag is absent, usedRange is returned as empty.

File with the issue (no <dimension> tag):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" ...>
  <!-- No <dimension> element here -->
  <sheetViews>...</sheetViews>
  <sheetData>
    <row r="1">...</row>
    <!-- 386 rows of data -->
  </sheetData>
</worksheet>

After re-saving with openpyxl (<dimension> tag added):

<dimension ref="A1:Z386"/>

usedRange correctly returns "A1:Z386".

Workaround

Re-saving the file with openpyxl (Python) before passing it to the MCP server adds the missing <dimension> tag:

import openpyxl
wb = openpyxl.load_workbook("file.xlsx")
wb.save("file.xlsx")

Environment

  • excel-mcp-server: v0.12.0 (also confirmed on latest)
  • Backend: excelize
  • OS: Linux (Docker container)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions