我正在阅读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>]
我想按列排序此列表,然后按行索引排序。关于如何做到这一点的任何想法?