@@ -71,7 +71,7 @@ def read_excel(io, sheetname=0, **kwds):
7171
7272 Parameters
7373 ----------
74- io : string, file-like object, or xlrd workbook.
74+ io : string, file-like object, or xlrd workbook.
7575 The string could be a URL. Valid URL schemes include http, ftp, s3,
7676 and file. For file URLs, a host is expected. For instance, a local
7777 file could be file://localhost/path/to/workbook.xlsx
@@ -166,7 +166,7 @@ def __init__(self, io, **kwds):
166166 self .book = io
167167 elif not isinstance (io , xlrd .Book ) and hasattr (io , "read" ):
168168 # N.B. xlrd.Book has a read attribute too
169- data = io .read ()
169+ data = io .read ()
170170 self .book = xlrd .open_workbook (file_contents = data )
171171 else :
172172 raise ValueError ('Must explicitly set engine if not passing in'
@@ -1029,21 +1029,24 @@ def _convert_to_alignment(cls, alignment_dict):
10291029 @classmethod
10301030 def _convert_to_number_format (cls , number_format_dict ):
10311031 """
1032- Convert ``number_format_dict`` to an openpyxl v2 NumberFormat object.
1032+ Convert ``number_format_dict`` to an openpyxl v2.1.0 number format
1033+ initializer.
10331034 Parameters
10341035 ----------
10351036 number_format_dict : dict
10361037 A dict with zero or more of the following keys.
1037- 'format_code'
1038+ 'format_code' : str
10381039 Returns
10391040 -------
1040- number_format : openpyxl.styles.NumberFormat
1041+ number_format : str
10411042 """
1042-
1043- from openpyxl .styles import NumberFormat
1044-
1045- return NumberFormat (** number_format_dict )
1046-
1043+ try :
1044+ # >= 2.0.0 < 2.1.0
1045+ from openpyxl .styles import NumberFormat
1046+ return NumberFormat (** number_format_dict )
1047+ except :
1048+ # >= 2.1.0
1049+ return number_format_dict ['format_code' ]
10471050
10481051 @classmethod
10491052 def _convert_to_protection (cls , protection_dict ):
0 commit comments