def parse(self):
        self.parse_workbook()
        if self.sheet_name is None:
            self.data = [{'name': name, 'data': self.get_sheet_by_name(name)}
                         for name in self.sheet_names]
            return

        sheet_name = self.sheet_name
        if isinstance(self.sheet_name, int):
            sheet_name = self.sheet_names[sheet_name]

        self.parse_worksheet(sheet_name)

        if self.header_row is None:
            if self.start_row is not None:
                self.header_row = self.start_row - 1
            else:
                self.column_count = 0

                def checkval(cell):
                    if cell.value is not None and cell.value != '':
                        return True
                    return False

                search_rows = min(len(self.worksheet) - 1, self.max_header_row)
                for row in range(search_rows, -1, -1):
                    count = len(list(filter(checkval, self.worksheet[row])))
                    if count >= self.column_count:
                        self.column_count = count
                        self.header_row = row

        if self.start_row is None:
            self.start_row = self.header_row + 1

        if self.field_names is None:
            rows = self.worksheet[self.header_row:self.start_row]
            self.field_names = [
                str(c.value) or 'c%s' % i for i, c in enumerate(rows[0])
            ]
            for row in rows[1:]:
                for i, c in enumerate(row):
                    self.field_names[i] += "\n" + str(c.value)

            seen_fields = set()
            for i, field in enumerate(self.field_names):
                if field in seen_fields:
                    field += str(i)
                    self.field_names[i] = field
                seen_fields.add(field)

        self.data = list(map(self.parse_row, self.worksheet[self.start_row:]))

        self.extra_data = {}
        if self.header_row > 0:
            for r in range(0, self.header_row):
                for c, cell in enumerate(self.worksheet[r]):
                    val = self.get_value(cell)
                    if val is not None and val != '':
                        self.extra_data.setdefault(r, {})
                        self.extra_data[r][c] = val
dataset/ETHPy150Open wq/wq.io/parsers/xls.py/WorkbookParser.parse/original