示例#1
0
文件: utils.py 项目: ropable/biosys
 def _write_species(self, file_path):
     ws = util_xls.get_or_create_sheet(self.wb, 'Species')
     species_ws = load_workbook(file_path).active
     col_max = species_ws.get_highest_row()
     species_list = [cell.value for (cell,) in list(species_ws.get_squared_range(1, 1, 1, col_max))]
     range_ = util_xls.append_column(ws, species_list)
     self.wb.create_named_range('species', ws, range_)
     return ws
示例#2
0
文件: utils.py 项目: ropable/biosys
 def _write_lookups(self):
     """
     Write the lookups as columns in the Lookups spreadsheet.
     For each column we register a named range.
     The name will be the name of the Lookup table (model) NOT the model field name because some fields refer to the
     same lookup tables (ex DisturbanceIndicator and the FeralEvidenceLookup)
     :return:
     """
     # First gather all the lookups tables
     lookups = self._build_lookups_dict()  # key=lookup name  value=lookup values(list)
     # Then for every lookups write a column in Lookup datasheet and register the range
     ws = util_xls.get_or_create_sheet(self.wb, 'Lookups')
     for name, values in lookups.items():
         if len(values) > 0:
             range_ = util_xls.append_column(ws, values)
             self.wb.create_named_range(name, ws, range_)
     return ws