答案 0 :(得分:0)
请检查以下和xlrd包,它将帮助您解决问题。
excelbook = xlrd.open_workbook("excel urt", formatting_info=True)
excel_sheets = excelbook.sheet_names()
for item, exsh in enumerate(excel_sheets):
excel_sheet = excelbook.sheet_by_index(item)
rows, cols = excel_sheet.nrows, excel_sheet.ncols
for row in range(rows):
for col in range(cols):
thecell = excel_sheet.cell(row, col)
xfx = excel_sheet.cell_xf_index(row, col)
xf = excelbook.xf_list[xfx]
bgx = xf.background.pattern_colour_index
print bgx
答案 1 :(得分:0)
使用openpyxl你可以读取rgb hex类型的基本颜色,但你需要检查python和openpyxl,这个库正处于开发阶段
from openpyxl import load_workbook
wb = load_workbook(filename='testfile.xlsx', read_only=True)
worksheet = wb.active
print(worksheet['A1'].font.color)