我正在阅读一个 xlsx 文件,就像这样,
import openpyxl
book = openpyxl.load_workbook('test.xlsx')
sheet = book.get_sheet_by_name(sheets['DATA'])
allCells = sheet.get_cell_collection()
print allCells
allCells 是 openpyxl.cell.Cell 对象的无序列表。allCells 看起来像,
[<Cell Data.B4>, <Cell Data.A6>, <Cell Data.B6>, <Cell Data.A1>, <Cell Data.B5>, <Cell Data.A3>, <Cell Data.A2>, <Cell Data.A5>, <Cell Data.B1>, <Cell Data.B2>]
我想按列排序这个列表,然后按行索引。关于如何做到这一点的任何想法?