thebook = open_workbook(file_to_import)
thesheet = thebook.sheet_by_index(0)
print "show that there is value in the sheet: %s" % thesheet.cell(1,1).value
print "there is nothing in thesheet.col_label_ranges:"
print thesheet.col_label_ranges
for crange in thesheet.col_label_ranges:
rlo, rhi, clo, chi = crange
for rx in xrange(rlo, rhi):
for cx in xrange(clo, chi):
print "Column label at (rowx=%d, colx=%d) is %r" \
(rx, cx, thesheet.cell_value(rx, cx))
我正在尝试获取特定单元格的行和列标签,并且我找到了循环遍历我在上面使用的 col_label_ranges 的代码。但是,当我运行此代码时,我得到的结果是:
show that there is value in the sheet: Katherine
there is nothing in thesheet.col_label_ranges:
[]
请告诉我出了什么问题,我应该怎么做才能读取单元格的行和列标签?