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
- Obtain an Excel file exported from certain tools/systems that do not include the
<dimension> tag (e.g., some Japanese business software exports)
- 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)
Description
excel_describe_sheetsreturns an emptyusedRangefor 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
<dimension>tag (e.g., some Japanese business software exports)excel_describe_sheetswith the fileExpected Behavior
usedRangeshould reflect the actual data range (e.g.,"A1:Z386").Actual Behavior
{ "backend": "excelize", "sheets": [ { "name": "シート1", "usedRange": "", "tables": [], "pivotTables": [], "pagingRanges": [] } ] }usedRangeis empty, and subsequentexcel_read_sheetcalls 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 forusedRangecalculation. When the tag is absent,usedRangeis returned as empty.File with the issue (no
<dimension>tag):After re-saving with openpyxl (
<dimension>tag added):→
usedRangecorrectly returns"A1:Z386".Workaround
Re-saving the file with openpyxl (Python) before passing it to the MCP server adds the missing
<dimension>tag:Environment