Skip to content

XLSX ingest fails when first worksheet row has no spans attribute #12856

Open

Description

@nightowlaz

Dataverse 6.11 fails to ingest an otherwise valid XLSX file when the first worksheet row does not contain the optional spans attribute (file may have been exported?).

The original XLSX fails to ingest. Opening the same file in Microsoft Excel and saving it as a new XLSX causes it to ingest successfully. Saving it as CSV also works. The column names and data do not appear to be the problem.

Error

Null r attribute in the first row element!
Null spans attribute in the first row element!

Ingest failure (IO Exception): Could not parse Excel/XLSX spreadsheet.
Cannot invoke "String.indexOf(int)" because "spansAttribute" is null.

Cause

The original worksheet XML contains a first row like:

<row r="1">

It does not contain a spans attribute such as:

<row r="1" spans="1:12">

The spans attribute is optional in XLSX/SpreadsheetML. XLSXFileReader checks whether it is null but then calls spansAttribute.indexOf(':'), resulting in the exception.

Steps to reproduce

  • Create or upload an XLSX whose first worksheet row omits the spans attribute.
  • Upload it to a dataset and allow tabular ingest to run.
  • Observe that ingest fails with the exception above.
  • Open the same file in Microsoft Excel, save it as a new XLSX, and upload it again.
  • Observe that the rewritten XLSX ingests successfully.

Environment

Dataverse 6.11

I did look through open issues and I don't think this one is mentioned yet, but I could have missed it.

Activity

  1. adityaanikam commented on Oct 28, 2026

    @adityaanikam

    I looked at XLSXFileReader.startElement and the cause is visible in the code.

    When the spans attribute is missing, the code logs Null spans attribute in the first row element! and then still calls spansAttribute.indexOf(':') on the next statement. That call is outside the try block, so a NullPointerException is thrown before the existing check that throws a SAXException ("Could not establish column count...") can run.

    A null guard stops the crash, but varCount then has to come from somewhere. I see three options: (1) throw that existing SAXException with a clearer message, (2) count the <c> elements in the first row, (3) read the dimension reference of the sheet. Which would you like? I can send a PR with a test using a small XLSX whose first row has no spans attribute.

    AI disclosure: an AI assistant (Claude) helped me investigate this and draft this comment. The code references were checked against the current default branch.

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

    Type: Bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions