Skip to content

Instantly share code, notes, and snippets.

@JohnLaTwC
Created May 24, 2020 16:55
Show Gist options
  • Save JohnLaTwC/33afaa31a7f072ac126c93bd41ce5696 to your computer and use it in GitHub Desktop.
Save JohnLaTwC/33afaa31a7f072ac126c93bd41ce5696 to your computer and use it in GitHub Desktop.
get_cell_info
def get_cell_info(self,sheet_name, col, row, type_ID):
sheet = self._excel.Excel4MacroSheets(sheet_name)
cell = col+row
data = None
if int(type_ID) == 2:
data = sheet.Range(col+row).Row
print(data)
return data
elif int(type_ID) == 3:
data = sheet.Range(cell).Column
print(data)
return data
elif int(type_ID) == 8:
data = sheet.Range(cell).HorizontalAlignment
elif int(type_ID) == 17:
data = sheet.Range(cell).Height
elif int(type_ID) == 19:
data = sheet.Range(cell).Font.Size
elif int(type_ID) == 20:
data = sheet.Range(cell).Font.Bold
elif int(type_ID) == 21:
data = sheet.Range(cell).Font.Italic
elif int(type_ID) == 23:
data = sheet.Range(cell).Font.Strikethrough
elif int(type_ID) == 24:
data = sheet.Range(cell).Font.ColorIndex
elif int(type_ID) == 50:
data = sheet.Range(cell).VerticalAlignment
else:
print("Unknown info_type (%d) at cell %s" % (type_ID, cell))
return data, False, False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment