File tree 1 file changed +4
-8
lines changed 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -1149,20 +1149,16 @@ def __init__(self, path_or_buf):
1149
1149
except ImportError : # pragma: no cover
1150
1150
raise ImportError (_openpyxl_msg )
1151
1151
else :
1152
- import tempfile
1153
- fd = tempfile .NamedTemporaryFile ()
1154
- fd .write (path_or_buf .read ())
1155
- fd .seek (0 )
1152
+ data = path_or_buf .read ()
1156
1153
1157
1154
try :
1158
1155
import xlrd
1159
- self .book = xlrd .open_workbook (fd . name )
1156
+ self .book = xlrd .open_workbook (file_contents = data )
1160
1157
self .use_xlsx = False
1161
1158
except Exception :
1162
1159
from openpyxl .reader .excel import load_workbook
1163
- self .book = load_workbook (fd .name , use_iterators = True )
1164
-
1165
- self .tmpfile = fd
1160
+ buf = py3compat .BytesIO (data )
1161
+ self .book = load_workbook (buf , use_iterators = True )
1166
1162
1167
1163
def __repr__ (self ):
1168
1164
return object .__repr__ (self )
You can’t perform that action at this time.
0 commit comments