@@ -303,7 +303,7 @@ def read_excel(io,
303
303
skipfooter = 0 ,
304
304
convert_float = True ,
305
305
** kwds ):
306
-
306
+ encoding = kwds . get ( "encoding" )
307
307
# Can't use _deprecate_kwarg since sheetname=None has a special meaning
308
308
if is_integer (sheet_name ) and sheet_name == 0 and 'sheetname' in kwds :
309
309
warnings .warn ("The `sheetname` keyword is deprecated, use "
@@ -315,7 +315,7 @@ def read_excel(io,
315
315
"`sheet`" )
316
316
317
317
if not isinstance (io , ExcelFile ):
318
- io = ExcelFile (io , engine = engine )
318
+ io = ExcelFile (io , engine = engine , encoding = encoding )
319
319
320
320
return io .parse (
321
321
sheet_name = sheet_name ,
@@ -358,7 +358,7 @@ class ExcelFile(object):
358
358
def __init__ (self , io , ** kwds ):
359
359
360
360
err_msg = "Install xlrd >= 0.9.0 for Excel support"
361
-
361
+ encoding = kwds . get ( "encoding" )
362
362
try :
363
363
import xlrd
364
364
except ImportError :
@@ -400,9 +400,15 @@ def __init__(self, io, **kwds):
400
400
pass
401
401
402
402
data = io .read ()
403
- self .book = xlrd .open_workbook (file_contents = data )
403
+ if encoding :
404
+ self .book = xlrd .open_workbook (file_contents = data , encoding_override = encoding )
405
+ else :
406
+ self .book = xlrd .open_workbook (file_contents = data )
404
407
elif isinstance (self ._io , compat .string_types ):
405
- self .book = xlrd .open_workbook (self ._io )
408
+ if encoding :
409
+ self .book = xlrd .open_workbook (self ._io , encoding_override = encoding )
410
+ else :
411
+ self .book = xlrd .open_workbook (self ._io )
406
412
else :
407
413
raise ValueError ('Must explicitly set engine if not passing in'
408
414
' buffer or path for io.' )
0 commit comments