I am writing a set of records in excel but I am not supposed to create a physical file. How do I write the records in excel in memory? If I do write it, how do I see the output of the records? I have tried:
import xlsxwriter
import io
filename= io.BytesIO()
workbook=xlsxwriter.Workbook(filename,{'in_memory': True})
worksheet=workbook.add_worksheet('sheet1')
worksheet.write(1,1,'Testing')
print(workbook.get_worksheet_by_name('sheet1'))
workbook.close()
filenameshould be a string (and from the documentation it doesn't sound like you need to be usingio.BytesIOanyway).