@@ -270,7 +270,7 @@ def pandasToDictList(dataframe):
270
270
trialList .append (thisTrial )
271
271
return trialList , fieldNames
272
272
273
- if fileName .endswith ('.csv' ) or (fileName .endswith (('.xlsx' ,'.xls' ))
273
+ if fileName .endswith ('.csv' ) or (fileName .endswith (('.xlsx' ,'.xls' , '.xlsm' ))
274
274
and haveXlrd ):
275
275
if fileName .endswith ('.csv' ):
276
276
trialsArr = pd .read_csv (fileName , encoding = 'utf-8-sig' )
@@ -284,7 +284,7 @@ def pandasToDictList(dataframe):
284
284
logging .debug (u"Clearing unnamed columns from {}" .format (fileName ))
285
285
trialList , fieldNames = pandasToDictList (trialsArr )
286
286
287
- elif fileName .endswith ('.xlsx' ):
287
+ elif fileName .endswith (( '.xlsx' , '.xlsm' ) ):
288
288
if not haveOpenpyxl :
289
289
raise ImportError ('openpyxl or xlrd is required for loading excel '
290
290
'files, but neither was found.' )
@@ -309,7 +309,11 @@ def pandasToDictList(dataframe):
309
309
# get parameter names from the first row header
310
310
fieldNames = []
311
311
for colN in range (nCols ):
312
- fieldName = ws .cell (_getExcelCellName (col = colN , row = 0 )).value
312
+ if parse_version (openpyxl .__version__ ) < parse_version ('2.0' ):
313
+ fieldName = ws .cell (_getExcelCellName (col = colN , row = 0 )).value
314
+ else :
315
+ # From 2.0, cells are referenced with 1-indexing: A1 == cell(row=1, column=1)
316
+ fieldName = ws .cell (row = 1 , column = colN + 1 ).value
313
317
fieldNames .append (fieldName )
314
318
_assertValidVarNames (fieldNames , fileName )
315
319
@@ -318,7 +322,11 @@ def pandasToDictList(dataframe):
318
322
for rowN in range (1 , nRows ): # skip header first row
319
323
thisTrial = {}
320
324
for colN in range (nCols ):
321
- val = ws .cell (_getExcelCellName (col = colN , row = rowN )).value
325
+ if parse_version (openpyxl .__version__ ) < parse_version ('2.0' ):
326
+ val = ws .cell (_getExcelCellName (col = colN , row = 0 )).value
327
+ else :
328
+ # From 2.0, cells are referenced with 1-indexing: A1 == cell(row=1, column=1)
329
+ val = ws .cell (row = rowN + 1 , column = colN + 1 ).value
322
330
# if it looks like a list or tuple, convert it
323
331
if (isinstance (val , basestring ) and
324
332
(val .startswith ('[' ) and val .endswith (']' ) or
0 commit comments