def load_workbook(filename, use_iterators=False):
 if isinstance(filename, file):
  if ('b' not in filename.mode):
   raise OpenModeError('File-object must be opened in binary mode')
 try:
  archive = ZipFile(filename, 'r', ZIP_DEFLATED)
 except (BadZipfile, RuntimeError, IOError, ValueError):
  raise InvalidFileException()
 wb = Workbook()
 if use_iterators:
  wb._set_optimized_read()
 try:
  _load_workbook(wb, archive, filename, use_iterators)
 except KeyError:
  raise InvalidFileException()
 finally:
  archive.close()
 return wb

def load_workbook ( filename , use_iterators = False ) : if isinstance ( filename , file ) : if ( 'b' not in filename . mode ) : raise OpenModeError ( 'File-object must be opened in binary mode' ) try : archive = ZipFile ( filename , 'r' , ZIP_DEFLATED ) except ( BadZipfile , RuntimeError , IOError , ValueError ) : raise InvalidFileException ( ) wb = Workbook ( ) if use_iterators : wb . _set_optimized_read ( ) try : _load_workbook ( wb , archive , filename , use_iterators ) except KeyError : raise InvalidFileException ( ) finally : archive . close ( ) return wb
open the given filename and return the workbook .