Last active
August 1, 2019 06:02
-
-
Save secsilm/a6cfa1addab089df23b242893e50f1f2 to your computer and use it in GitHub Desktop.
Python 读取 excel 文件并保留格式
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openpyxl import load_workbook | |
def read_color(f): | |
wb = load_workbook(f) | |
ws = wb.active | |
for row in ws.iter_rows(): | |
for cell in row: | |
print(f"cell value={cell.value}, cell color={cell.fill.start_color.index}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment