@@ -437,43 +437,35 @@ def use_inf_as_na_cb(key):
437
437
writer_engine_doc = """
438
438
: string
439
439
The default Excel writer engine for '{ext}' files. Available options:
440
- '{default}' (the default){others}.
441
- """
442
-
443
- with cf .config_prefix ('io.excel' ):
444
- # going forward, will be additional writers
445
- for ext , options in [('xls' , ['xlwt' ]), ('xlsm' , ['openpyxl' ])]:
446
- default = options .pop (0 )
447
- if options :
448
- options = " " + ", " .join (options )
449
- else :
450
- options = ""
451
- doc = writer_engine_doc .format (ext = ext , default = default ,
452
- others = options )
453
- cf .register_option (ext + '.writer' , default , doc , validator = str )
454
-
455
- def _register_xlsx (engine , other ):
456
- cf .register_option ('xlsx.writer' , engine ,
457
- writer_engine_doc .format (ext = 'xlsx' , default = engine ,
458
- others = ", '%s'" % other ),
459
- validator = str )
460
-
461
- _excel_registered = False
462
-
463
-
464
- def _register_excel_engines ():
465
- global _excel_registered
466
-
467
- if not _excel_registered :
468
- with cf .config_prefix ('io.excel' ):
469
- try :
470
- # better memory footprint
471
- import xlsxwriter # noqa
472
- _register_xlsx ('xlsxwriter' , 'openpyxl' )
473
- except ImportError :
474
- # fallback
475
- _register_xlsx ('openpyxl' , 'xlsxwriter' )
476
- _excel_registered = True
440
+ auto, {others}.
441
+ """
442
+
443
+ _xls_options = ['xlwt' ]
444
+ _xlsm_options = ['openpyxl' ]
445
+ _xlsx_options = ['openpyxl' , 'xlsxwriter' ]
446
+
447
+
448
+ with cf .config_prefix ("io.excel.xls" ):
449
+ cf .register_option ("writer" , "auto" ,
450
+ writer_engine_doc .format (
451
+ ext = 'xls' ,
452
+ others = ', ' .join (_xls_options )),
453
+ validator = str )
454
+
455
+ with cf .config_prefix ("io.excel.xlsm" ):
456
+ cf .register_option ("writer" , "auto" ,
457
+ writer_engine_doc .format (
458
+ ext = 'xlsm' ,
459
+ others = ', ' .join (_xlsm_options )),
460
+ validator = str )
461
+
462
+
463
+ with cf .config_prefix ("io.excel.xlsx" ):
464
+ cf .register_option ("writer" , "auto" ,
465
+ writer_engine_doc .format (
466
+ ext = 'xlsx' ,
467
+ others = ', ' .join (_xlsx_options )),
468
+ validator = str )
477
469
478
470
479
471
# Set up the io.parquet specific configuration.
0 commit comments