Skip to content

[FIX] Excel readers: Keep empty flags row of three-line header - #7334

Open
raashish1601 wants to merge 1 commit into
biolab:masterfrom
raashish1601:fix/7276-excel-empty-flags-row
Open

raashish1601 wants to merge 1 commit into
biolab:masterfrom
raashish1601:fix/7276-excel-empty-flags-row

Conversation

@raashish1601

Copy link
Copy Markdown
Issue

Fixes #7276

Description of changes

ExcelReader.get_cells and XlsReader.get_cells dropped every empty row (filter(any, ...)) before the header was parsed. A file saved with type annotations but without class, metas or weights has an empty third (flags) header row. That row was dropped, so parse_headers saw the first data row in its place and did not recognize a three-line header. The names became a one-line header and the types row was read as data, which gives the strange table in the issue.

The readers now keep empty rows. ExcelReader still skips leading empty rows; XlsReader already starts at the first non-empty row. Empty data rows are still dropped, because adjust_data_width in data_table filters them, which is also how the tab/csv reader handles them.

Tests: test_write_file_without_flags writes iris without its class with with_annotations=True and reads it back. test_read_empty_flags reads new header_3_no_flags.xlsx/.xls files with an empty flags row through both readers. Both fail on master (the xlsx round trip gives 151 rows instead of 150, and the xls file reads a as a meta) and pass with the change. Orange.tests.test_io, test_tab_reader, test_txt_reader, test_xlsx_reader, test_table, Orange.data.tests.test_io and the distance matrix xlsx tests pass locally.

Includes
  • Code changes
  • Tests
  • Documentation

ExcelReader and XlsReader dropped all empty rows before parsing the
header. A three-line header whose flags row is empty (e.g. data without
class and metas saved with type annotations) then lost its third row,
so the header was not recognized and the types row was read as data.
Empty data rows are already skipped in data_table.
@CLAassistant

CLAassistant commented Oct 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@janezd janezd assigned janezd and markotoplak and unassigned janezd Oct 9, 2026
@janezd janezd added this to the 3.41 milestone Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excel reader does not work for files with just features (no classes) with 3-line header

4 participants