Convert an excel or spreadsheet column letter to its number in Pythonic fashion

前端 未结 17 1221
夕颜
夕颜 2020-12-09 04:18

Is there a more pythonic way of converting excel-style columns to numbers (starting with 1)?

Working code up to two letters:



        
17条回答
  •  感情败类
    2020-12-09 04:48

    Using openpyxl

    import openpyxl
    (column_string, row) = openpyxl.cell.coordinate_from_string(address)
    column = openpyxl.cell.column_index_from_string(column_string) 
    

提交回复
热议问题