Beispiel #1
0
def xlrd_sheet_to_list_of_dict(sheet: Sheet) -> List[Dict]:
    """Convert an xlrd sheet into a list of dicts."""
    keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)]
    dict_list = []
    for row_index in range(1, sheet.nrows):
        d = {keys[col_index]: sheet.cell(row_index, col_index).value
             for col_index in range(sheet.ncols)}
        dict_list.append(d)
    return dict_list
 def process_table(self, row_index:int, sheet:Sheet):
     self.current_table_name = sheet.cell(row_index, 0).value
     self.current_table = Table(self.schema, self.current_table_name, [], [])
Beispiel #3
0
def read_student_info(sheet: Sheet, file_name: str) -> dict:
    student_id = file_name.replace('student_', '').replace('.xlsx', '')
    student_name = sheet.cell(0, 4).value
    student_score = round(sheet.cell(15, 4).value, 1)
    print('[read_student_info]\t' + student_id + ' : ' + student_name + ' : ' + str(student_score))
    return {'id': student_id, 'name': student_name, 'score': student_score}
 def process_schema(self, row_index:int, sheet:Sheet):
     self.schema = sheet.cell(row_index, 0).value