def write_headers(self, readers): sheet_count = 0 for attribute in self.attributes: # Create sheet for each attribute sheet_count += 1 self.sheet_names[ sheet_count] = attribute # store original sheet name for Key sheet_name = attribute.replace( '/', "") # Sheet names do not support slashes sheet_name = "%s-%s" % (str(sheet_count), sheet_name) if len(sheet_name) > MAX_SHEET_NAME_LENGTH: sheet_name = sheet_name[:26] sheet_name += '...' write_sheet = self.book.add_sheet(sheet_name) # Create the sheet self.attribute_sheets[ attribute] = write_sheet # store right sheet to get later # Set up sheets headers write_sheet.write(0, 0, 'SubjectID') col_names = set() for reader in readers: for stat in reader.get_sheet_names(): col_name = self.__get_header(stat) col_names.add(col_name) col_num = 1 row_num = 0 for col_name in col_names: try: write_sheet.write(row_num, col_num, col_name) except: raise IPatchException( "Could not write header: {0}".format(col_name)) if attribute not in self.header_to_col_num: self.header_to_col_num[attribute] = {} self.header_to_col_num[attribute][col_name] = col_num col_num += 1