def save_virtual_workbook(workbook):
 writer = ExcelWriter(workbook)
 temp_buffer = StringIO()
 try:
  archive = ZipFile(temp_buffer, 'w', ZIP_DEFLATED)
  writer.write_data(archive)
 finally:
  archive.close()
 virtual_workbook = temp_buffer.getvalue()
 temp_buffer.close()
 return virtual_workbook

def save_virtual_workbook ( workbook ) : writer = ExcelWriter ( workbook ) temp_buffer = StringIO ( ) try : archive = ZipFile ( temp_buffer , 'w' , ZIP_DEFLATED ) writer . write_data ( archive ) finally : archive . close ( ) virtual_workbook = temp_buffer . getvalue ( ) temp_buffer . close ( ) return virtual_workbook
return an in-memory workbook .