openpyxl 实现excel字母列号与数字列号之间的转换

openpyxl 实现excel字母列号与数字列号之间的转换

from openpyxl.utils import get_column_letter, column_index_from_string

# 根据列的数字返回字母
print(get_column_letter(2))  # B
# 根据字母返回列的数字
print(column_index_from_string('D'))  # 4

---------------------

本文来自 憶 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/weixin_43094965/article/details/82226263?utm_source=copy