def run(self, key, sheet='Sheet', variables='[]', excel_file=None, key_column=None, variable_name_row=None): self.replace_defaults(excel_file, key_column, variable_name_row) excel = excel_reader.ExcelReader(self._excel_file) excel.set_sheet(sheet, key_column=self._key_column, var_name_row=self._var_name_row, strict=True) vfk = excel.get_variables_for_key(key) if variables == '[]': # default vfk['key'] = key return vfk variables = json.loads(variables) filtered = {} for var_name in variables: if var_name in vfk: filtered[var_name] = vfk[var_name] filtered['key'] = key return filtered
def run(self, excel_file=None): self.replace_defaults(excel_file, None, None) excel = excel_reader.ExcelReader(self._excel_file) return excel.get_sheets()
def run(self, sheet, excel_file=None, key_column=None, variable_name_row=None): self.replace_defaults(excel_file, key_column, variable_name_row) excel = excel_reader.ExcelReader(self._excel_file) excel.set_sheet(sheet, key_column=self._key_column, var_name_row=self._var_name_row, strict=True) return excel.get_variable_names()
def run(self, sheet, excel_file=None, key_column=None, variable_name_row=None, strict=True): self.replace_defaults(excel_file, key_column, variable_name_row) excel = excel_reader.ExcelReader(self._excel_file) try: excel.set_sheet(sheet, key_column=self._key_column, var_name_row=self._var_name_row, strict=strict) except excel_reader.UnlockedSheetError: # Sheet doesn't exist and we haven't locked sheet as do not # want to modify it on get return [] return excel.get_keys()
def run(self, sheet, key, variables, strict, excel_file=None, key_column=None, variable_name_row=None): self.replace_defaults(excel_file, key_column, variable_name_row) data = json.loads(variables) excel = excel_reader.ExcelReader(self._excel_file, lock=True) excel.set_sheet(sheet, key_column=self._key_column, var_name_row=self._var_name_row, strict=strict) excel.set_values_for_variables(key, data) excel.save() return (True, 'Success')
def run(self, sheet, key, strict, excel_file=None, key_column=None, variable_name_row=None): self.replace_defaults(excel_file, key_column, variable_name_row) excel = excel_reader.ExcelReader(self._excel_file, lock=True) excel.set_sheet(sheet, key_column=self._key_column, var_name_row=self._var_name_row, strict=strict) key = string_converter.convert_string_to_float_int(key) excel.delete_row(key) excel.save() return (True, 'Success')