I am able to use openpyxl as an import in my code. But when I try to do the following:
from openpyxl.cell import get_column_letter
I get the following error:
ImportError: cannot import name get_column_letter
I am using python 2.7. I have installed it using easy_install
. Tried searching for this issue but couldn't find anything related to it.
The function get_column_letter
has been relocated in Openpyxl version 2.4 from openpyxl.cell
to openpyxl.utils
.
The current import is: from openpyxl.utils import get_column_letter
If you do not know which version the end-user has, you can use the following code:
try:
from openpyxl.cell import get_column_letter
except ImportError:
from openpyxl.utils import get_column_letter
from openpyxl.utils import get_column_letter
This is working for Python3 also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With