python xlrd - Retrieve Column index from sheet
===

Hi I am just picking up xlrd. Regarding access to sheets and cell properties I am referring to [Xlrd Column][1]

The code from there shows.

    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))

So i thought i would just test printing out cell A1 from the sheet "Data", so I started to copy the above example.

When it completes however it errors at col_label_ranges:

    inBook = xlrd.open_workbook('T:/AzReporting/DraftUtilization.xls')
    outBook = xlutils.copy.copy(inBook)
    for crange in outBook.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, outBook.cell_value(0, 0))
                
    Traceback (most recent call last):
      File "<interactive input>", line 1, in <module>
    AttributeError: 'Workbook' object has no attribute 'col_label_ranges'

Also if I change col_label_names to be the worksheet name it also errors. I mus tbe missing something with this example. Maybe there is a better tutorial to follow?

    for crange in outBook.Data:

  [1]: http://www.lexicon.net/sjmachin/xlrd.html#xlrd.Sheet.col_label_ranges-attribute




