Domanda

I'm automating formula's using pythons XLWT library. I have column indexs, eg, 1,2,3,99, etc and would like to convert to A,B,C,D, AA,AB, etc.

Is there anything built into xlwt for this? Or should I just write my own function?

È stato utile?

Soluzione

You can use xlrds helper function:

import xlrd
print xlrd.colname(56)
# BE

Strangely - there doesn't appear to be a direct equivalent in xlwt or xlwt.Utils (although this does have various helper functions for conversion of cells and names)

Going by the question's title - you can use:

>>> xlwt.Utils.rowcol_to_cell(5, 2)
'C6'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top