Skip to content

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

Description

@markotoplak

What's wrong and how can we reproduce the problem?

I took the iris data set, removed the class in select rows, and saved it as Excel with "Add type annotations to header".

Image

Loading the file then shows something really strange.

Image

File was written correctly - looks the same as a written file .tab file. I guess the empty line causes issues. A file without this Orange's header works well.

Here is the file: iris.xlsx

Activity

  1. added
    bug reportBug is reported by user, not yet confirmed by the core team
    on Apr 17, 2026
  2. dhiraje1990 commented on Apr 25, 2026

    @dhiraje1990

    I guess the empty line causes issues.

    It is being skipped by the return filter(any, cells) in the get_cells method in ExcelReader before the cells are passed to data_table(). The third header should be flags. Should they be considered plain features if the flags are empty?

  3. dhiraje1990 commented on Apr 25, 2026

    @dhiraje1990
        def get_cells(self) -> Iterable:
            def str_(x):
                return str(x) if x is not None and x not in ExcelReader.ERRORS \
                    else ""
    
            sheet = self._get_active_sheet()
            min_col = sheet.min_column
            max_col = sheet.max_column
            cells = ([str_(cell.value) for cell in row[min_col - 1: max_col]]
                     for row in sheet.iter_rows(sheet.min_row, sheet.max_row + 1))
    
            header_row_num = 3 if self.OPTIONAL_TYPE_ANNOTATIONS else 1
            header = list(islice(cells, header_row_num))
            data = filter(any, cells)  # only filter empties in data rows
            return chain(header, data)
    

    This works on my local and all test cases passed. but will 3 be enough?

  4. added
    bugA bug confirmed by the core team
    and removed
    bug reportBug is reported by user, not yet confirmed by the core team
    on May 14, 2026
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

    bugA bug confirmed by the core team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions