def export_to_xlsx(table, filename_or_fobj=None, sheet_name="<STR_LIT>", *args, **kwargs):
workbook = Workbook()<EOL>sheet = workbook.active<EOL>sheet.title = sheet_name<EOL>prepared_table = prepare_to_export(table, *args, **kwargs)<EOL>field_names = next(prepared_table)<EOL>for col_index, field_name in enumerate(field_names):<EOL><INDENT>cell = sheet.cell(row=<NUM_LIT:1>, column=col_index + <NUM_LIT:1>)<EOL>cell.value = field_name<EOL><DEDENT>_convert_row = _python_to_cell(list(map(table.fields.get, field_names)))<EOL>for row_index, row in enumerate(prepared_table, start=<NUM_LIT:1>):<EOL><INDENT>for col_index, (value, number_format) in enumerate(_convert_row(row)):<EOL><INDENT>cell = sheet.cell(row=row_index + <NUM_LIT:1>, column=col_index + <NUM_LIT:1>)<EOL>cell.value = value<EOL>if number_format is not None:<EOL><INDENT>cell.number_format = number_format<EOL><DEDENT><DEDENT><DEDENT>return_result = False<EOL>if filename_or_fobj is None:<EOL><INDENT>filename_or_fobj = BytesIO()<EOL>return_result = True<EOL><DEDENT>source = Source.from_file(filename_or_fobj, mode="<STR_LIT:wb>", plugin_name="<STR_LIT>")<EOL>workbook.save(source.fobj)<EOL>source.fobj.flush()<EOL>if return_result:<EOL><INDENT>source.fobj.seek(<NUM_LIT:0>)<EOL>result = source.fobj.read()<EOL><DEDENT>else:<EOL><INDENT>result = source.fobj<EOL><DEDENT>if source.should_close:<EOL><INDENT>source.fobj.close()<EOL><DEDENT>return result<EOL>
Export the rows.Table to XLSX file and return the saved file.